I have an Excel spreadsheet with 7 cells (in a column) with data in, these are C13 to C19 I have a formula that combines all the data in these cells together and puts it into one cell, this formula is =C13&", "&C14&", "&C15&", "&C16&", "&C17&", "&C18&", "&C19 and works fine. However, can I alter this formula to miss out on any cell that contains the text "Nothing else carby"?
1
votes
2 Answers
0
votes
The formula should not be that long, as you can see:
=TEXTJOIN(",",TRUE,IF(C13:C19="Nothing","", C13:C19))
(I just used "Nothing" instead of the whole word for readability reasons.)
Explanation of the parameters:
"," : delimiter: between every cell content, a comma is added.
TRUE : treatment of blank cells (don't put them).
IF (...) : In case cell content is "Nothing", put an empty string.
In combination with the previous parameter,
just one comma will be put in the result:
"a,b,c,e,f,g" and not "a,b,c,,e,f,g" (see result).
Used data:
a
b
c
Nothing
e
f
g
Result:
a,b,c,e,f,g
TEXTJOIN()
if you haveExcel2019
orExcel365
. – Harun24HRNothing else carby
using wildcards*
. If the count is 0, return cell & ",". IF count is not 0, then return nothing "". And then combine all cells into one. Indeed a long formula. – Foxfire And Burns And BurnsIF(COUNTIF(C13;"*"&"Nothing else carby"&"*")=0;C13&", ";"")
– Foxfire And Burns And Burns