Forum Discussion
DrPepperFreak
Feb 23, 2023Copper Contributor
How to match phrases found in text?
The goal is to use a named range of the keywords/phrases to flag sentences in column A that have any of them in column B. I have not had luck with SEARCH or MATCH and would rather not use a macro or...
- Feb 23, 2023
DrPepperFreak
Feb 23, 2023Copper Contributor
Detlef_Lewin, thank you for taking the time to help. Ater taking a few minutes to figure out the trick and look up "--", this solution is AWESOME. I think it covers 99% of the cases.; however, I noticed that if one of the words or phrases happens to be adjacent to punctuation, it doesn't count it as a match (new requirement, huh?) Is there an equally elegant way to also deal with punctuation possibilities? Thank you for getting me 99% there. 🙂
Detlef_Lewin
Feb 24, 2023Silver Contributor
Not really an elegant way.
You have to substitute the punctuation with a space.
=SUM(--ISNUMBER(SEARCH(" "&$E$2:$E$5&" "," "&SUBSTITUTE(A2,"."," ")&" ")))=0