单元格查找的多次返回

时间:2018-07-02 13:04:25

标签: excel

我要询问的单元格中有文本字符串,然后在一个单元格中显示了所有匹配的文本值。

我当前正在使用:

=IF(ISNUMBER(SEARCH("horse",G360)),
    "horse",
    IF(ISNUMBER(SEARCH("cat",G360)),
       "cat",
       IF(ISNUMBER(SEARCH("monkey",G360)),
          "monkey", 
          IF(ISNUMBER(SEARCH("donkey",G346)),
          "donkey"))))

但是,这当然只显示第一个匹配值,而不是所有匹配值。我该怎么办?

如果一个单元格包含文本"blah cat blah blah monkey blah blah horses",则公式结果将是"Horse, Monkey",而不仅仅是"Horse"

1 个答案:

答案 0 :(得分:0)

我想在样本中甚至CAT也会出现。

对于有限数量的商品,您可以尝试:

=SUBSTITUTE(TRIM(CONCATENATE( IF(ISNUMBER(SEARCH("horse",G360)),"horse "," "), IF(ISNUMBER(SEARCH("cat",G360)),"cat "," "), IF(ISNUMBER(SEARCH("monkey",G360)),"monkey "," "), IF(ISNUMBER(SEARCH("donkey",G346)),"donkey "," ") ))," ",", ")