Forum Discussion
giuliost
Jan 05, 2022Copper Contributor
Help! If contains formula multiple options.
Hi, I need to do a formula to return different words like this: IF contains the word "Apple" then return "Fruit", or IF contains "plate" return "Restaurants", or IF contains the word "Gym" return the...
- Jan 05, 2022
The attached version will work in older versions of Excel too, but it will return only one category.
giuliost
Copper Contributor
It worked the Hans Vogelaar option but with only one category. I'll try again.
HansVogelaar
Jan 05, 2022MVP
For Excel 2019 and later, you can use TEXTJOIN to return multiple categories:
=TEXTJOIN(", ",TRUE,IF(ISNUMBER(SEARCH(Dict[word],[@Phrase])),Dict[category],""))
For Excel 2016 and earlier, you'd probably need a custom VBA function.