Just checking.
I'm not suggesting anything wrong with the suggestion but this sort of question typically throws up some anomalies that I thought worth raising in case it might affect your results.
I assume that the sample data provided is not your real data but I have added some items to the list and some more example data in column A. Points to note
- B8 includes "Animal" though to my mind there is no animal in A8
- B9 includes "Fruit" though to my mind there is no fruit in A9
- In List1 you have "Carrot" and listed the result of "Vegetable" when the plural "carrots" appeared in the data. I have "Berry" in List1 but naturally the formula does not pick up that plural in row 10 below.
If desired, the formula could be adjusted to remove "Animal" and "Fruit" from B8:B9 but that adjustment would also remove "Vegetable" from B5 since "carrot" is not found as a whole word in A5.
If you might have any data where no results are found as in my row 10, this slight adjustment to the formula would return a blank instead of the error.
=TEXTJOIN(", ",TRUE,FILTER($E$2:$E$9,ISNUMBER(SEARCH($D$2:$D$9,A2))
,""))
You may well still be entirely happy with the suggestion made previously, but if it turns out you want to pursue this further, a couple of other questions
- I note an apostrophe in the last row of your sample data. Does your real data have other punctuation/characters? eg Characters like these ? . ! " ( ) -
- Would a vba suggestion be acceptable?
- With an example like A4 of post 2, would you want "Fruit" returned twice in B4 like that or just once?