I'm trying to categorize some data in a Google spreadsheet.
- I have "phrases to screen" in column A, TAB "Phrases". For example "blueish house"
- I have "words" in column A, TAB "Words". For example, "blue"
- I have "categories" in column B, TAB "Words". For example, "color"
I created a sample file here: There's a link to a related post too that can help.
I'd like to use regular expressions using the words in column A to match some phrases in A, and then return the appropriate category from B.
For example, I'd like to find "blue" in "blueish house" and return "color". I'd like to find "white" in "great white shoes" and return "color", but not when followed by numbers. Hence, I need to use regular expressions.
I'm using the following formula in column C TAB "phrases". It works, but not with regular expressions. It returns the reg. expressions itself and then can't match the category.
=arrayformula(vlookup(arrayformula(iferror(regexextract(A2:A8,join("|",Words!$A$1:$A$7)))),Words!A$1:B,2,0))
I tried to adapt the formula (from the related post) in column D but it's not working.