Forum Discussion

moncho47's avatar
moncho47
Copper Contributor
Jun 06, 2020

Excel formula - returning multiple text strings in a cell

Hi, Newbie here. Is have a cell that could contain apples and/or oranges and/or pears. I'm able to use an IF formula to extract either apples or oranges or pears but get a false value when the cell c...
  • SergeiBaklan's avatar
    SergeiBaklan
    Jun 06, 2020

    moncho47 

    As variant if add list of possible variant in column O, and assuming your version of Excel supports TEXTJOIN,

    in M2 is

    =IF(
       LEN(TEXTJOIN(", ",1,IF(COUNTIF(B2,"*"&$O$2:$O$4&"*"),$O$2:$O$4,"")))=0,
       "apple",
       TEXTJOIN(", ",1,IF(COUNTIF(B2,"*"&$O$2:$O$4&"*"),$O$2:$O$4,""))
    )

    and drag it down.

Resources