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
Thanks SergeiBaklan ! Great Solution! But when I'm trying to use it in a lighter version of excel the formula doesn't work. Can you please help me with that? Thanks
SergeiBaklan
Jan 05, 2022MVP
Strange, your tag is "Excel for web", it shall work on it.
- giuliostJan 05, 2022Copper ContributorIt worked the Hans Vogelaar option but with only one category. I'll try again.
- HansVogelaarJan 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.