Google-sheets – Highlight the admin responses rows

conditional formattinggoogle sheets

I have a comment form and sheet on my site:
• Column A: Timestamp
• Column B: Name
• Column C: Comment

I'd like to highlight every row that includes the admin's answer. In other words, if a cell in column B has the text Admin, its entire row should have a background color. How should I use conditional formatting or something like that to achieve it?

Best Answer

Apply conditional formatting to the range A2:C with custom formula

=regexmatch($B2, "^admin$") 

The idea is that the formula should be written as it applies to the upper left corner of the formatted range, in this case A2. It will be automatically adjusted for other cells: for example, cell C6 will refer to B6, because row reference is relative while column reference is absolute.

Using regexmatch with the pattern "^admin$" ensures complete case-sensitive string match; ^ means the beginning of string and $ means its end.

If you want case-insensitive comparison, the formula is simply

 =$B2 = "admin"