Search code examples
google-sheetsconditional-formatting

Sheets conditional formatting if contains text from another cell


I have a Google sheet which has a column for business name (A) and a column for city (B). I would like to set conditional formatting such that if the city name is contained within the business name on the same row, the business name will be highlighted.

list example

Every row contains different business/city data, and there are thousands of rows. I need one formula that will work for the whole sheet.

I know how to do it if the city name and business name are exactly the same =$A$2:$A=$B2, but struggling to figure out how to do it if just a portion matches. Putting an asterisk before $B2 broke the formula.


Solution

  • =REGEXMATCH ($A2,$B2) would do the work too!