Reputation: 207
i am trying to categorize text with keywords. such that column b get category name of text in column A using helper column F and G where F is named range "keywords" and G is named range "category".
i was using this formula from exceljet but this only return first result
=INDEX(category,MATCH(TRUE,ISNUMBER(SEARCH(keywords,a1)),0))
Google is showing use of textjoin formula but I don't have office 365 subscription.
Upvotes: 0
Views: 122
Reputation: 3802
Formula solution.
1] For Office 365 and Excel 2019 user, the formula using Textjoin
function
In B1
, array formula (Confirm by pressing Ctrl+Shift+Enter) copied down :
=TEXTJOIN(", ",1,IF(ISNUMBER(SEARCH(F$1:F$5,A1)),G$1:G$5,""))
2] If you don't have Office 365 Textjoin function, try this longer formula solution for all Excel version.
To create a define name >>
=IFERROR(INDEX($G$1:$G$5,N(IF(1,AGGREGATE(15,6,ROW($A$1:$A$5)/ISNUMBER(SEARCH($F$1:$F$5,A1)),ROW($A$1:$A$10))))),"")
Then,
In B1
formula copied down :
=SUBSTITUTE(TRIM(IFERROR(INDEX(ArrayResult,1),"")&" "&IFERROR(INDEX(ArrayResult,2),"")&" "&IFERROR(INDEX(ArrayResult,3),"")&" "&IFERROR(INDEX(ArrayResult,4),"")&" "&IFERROR(INDEX(ArrayResult,5),""))," ",", ")
Upvotes: 1