Home » excel » excel – Format rows based on values in two cells in each row

excel – Format rows based on values in two cells in each row

Posted by: admin May 14, 2020 Leave a comment


I am trying to apply formatting conditionally:

If in row 1, C = 0 and D = 0 highlight the entire row 1, then repeat for each row.

I have the following formula:

=(AND($C$1=0, $D$1=0))

but with this I have two issues:

  • the formatting is applied just in row 1, and not subsequent rows
  • only the column I am applying the conditional formatting to is highlighted, rather than a complete row.

How can I achieve my goal?

How to&Answers:

A slight variation on @JNevill’s answer is to add provision to limit the CF to rows where C and D are not both blank (or your sheet may have a lot of highlighting if you do not limit the row range – and if you do limit the row range at some time in future it may not be sufficient). Blank cells trigger an =0 condition.

So a CF formula such as:


and an Applies to range such as:


or further “east” to suit:

SO260224013 example


You need to apply the condition to every column in every row that you want highlighted. Also your formula shouldn’t have the Rows locked with the $ symbol. It should read: =AND($C1=0, $D1=0)