kalenpw
kalenpw

Reputation: 695

Excel formula highlight entire row on condition

I want to highlight an entire row if 2 conditions are true:

  1. Row number is even
  2. A specific cell in that row in G column contains certain text

I have a formula that is pretty much what I need it works, but it doesn't highlight the entire row just a specific cell:

=AND(MOD(ROW(),2)=0, G42="A")

The issue is if that condition is true I want to highlight the entire row where is is true. G42 is just a placeholder I used to test I need this to apply to the entire row based off the rows respective G$number

I'm fairly certain this is a simple task, but as I search for how to highlight the entire row most of the answers I find involve using one of the builtin rules, but in my case I need to use a formula so I can ensure it only applies to even rows.

Thanks

Upvotes: 0

Views: 192

Answers (1)

Mark Fitzgerald
Mark Fitzgerald

Reputation: 3068

Your reference to G42 need to be column absolute and row relative as in $G42.

Select all cells in the UsedRange on row 42 and enter this formula in the Conditional Formatting dialogue:

`=AND(MOD(ROW(),2)=0, $G42="A")`

You can then copy/paste the format to other cells/rows and the $G42 part should change for the specific row to which the format applies.

I recommend not applying conditional formats to entire rows because they are volatile (i.e. are recalculated every time Excel recalculates). It could also result in workbook size bloat.

Upvotes: 1

Related Questions