组合单元格,除非单元格包含特定文本

Combining cells unless a cell contains certain text

我有一个 Excel 电子表格,其中有 7 个单元格(在一列中),其中包含数据,这些是 C13 到 C19 我有一个公式将这些单元格中的所有数据组合在一起并放入一个单元格中,这个公式是 =C13&", "&C14&", "&C15&", "&C16&", " &C17&", "&C18&", "&C19 并且工作正常。但是,我能否更改此公式以遗漏任何包含文本“Nothing else carby”的单元格?

您可以在 Excel 2019 年使用:

=TEXTJOIN(", ",,IF(C13:C19<>"Nothing else carby",C13:C19,""))

如果“Nothing else carby”可以是单元格值内的子字符串,请尝试:

=TEXTJOIN(", ",,IF(ISNUMBER(FIND("Nothing else carby",C13:C19)),"",C13:C19))

通过CtrlShiftEnter

确认

公式不应该那么长,如您所见:

=TEXTJOIN(",",TRUE,IF(C13:C19="Nothing","", C13:C19))

(出于可读性原因,我只是使用“Nothing”而不是整个单词。)

参数说明:

"," : 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).

已用数据:

a
b
c
Nothing
e
f
g

结果:

a,b,c,e,f,g