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?

1 Answer 1


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" 
  • Thanks for the answer, but it covers any string including "admin". For example it also covers "admins". I want the text to be exactly "admin", no more.
    – Mori
    Jul 18, 2017 at 0:10
  • Great answer! The second approach can be even a bit simpler: range A:C; formula: =$B1 = "Admin".
    – Mori
    Jul 18, 2017 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.