Google-sheets – How to filter after parsing CSV values contained in Google Sheets cells

concatenategoogle sheetsgoogle-sheets-arrayformulagoogle-sheets-queryregex

I would like to be able to match all cells in column A (titles) that have one of the comma-separated values in column E (Key Search Terms). This will involve at least two steps. 1) Parse each of the respective key search term cells into and array of trimmed text values (eg cell E10 would be ["stuff", "food fluff", "green"]. 2) Regex match the exact pattern contained under the tags column (column F).

The desired result in the second image depicted below will be a filter that only allows the article title "Hating on Food: A Viable Source of Catharsis?" to get through. Note that "Being Cool: A Guide" did NOT make the cut because although it contains the word "food" in its corresponding key search terms cell it is in the context of "food fluff" which is a distinct value from "food" in isolation.

I could puzzle over this for a while but I have a client that needs a quick solution and I'm having trouble seeing how to realize this result. I think I have completed part step one with the following formula: ARRAYFORMULA(TRIM(SPLIT(E10, ","))) This shows the parsing of a single cell into an array from its CSV value– in this case "stuff", "food fluff", "green".

PS here is a link to the sheet in question

Tags to Parse

enter image description here

Best Answer

Try this in F10 for the tenth row :

=textjoin(",",false,ArrayFormula(iferror(REGEXEXTRACT(A10,TRANSPOSE(ARRAYFORMULA(TRIM(SPLIT(E10, ","))))))))

Basically REGEXTRACT() accept arrays.