SOLVED

# Conditional Formatting- Greater than multiple cells

Occasional Visitor

# Conditional Formatting- Greater than multiple cells

Hello,

Im trying to conditionally format cells that are greater than either values from 2 other cells:

I want to colour any of the white shaded cells in the same row that are greater than either value in the dark grey cells. As you can see some cells will not have any values.

Id like to avoid having to do two conditional format rules for each row, as there will be quite a few rows so if there is a way to use one formula for the whole block id love to learn.

(also is there a way for the formula to ignore the '<' symbol? those cells are formatted as numbers but it still causes an error)

EDIT: Thank you both for the help. Both methods work great.

2 Replies
best response confirmed by Manzi69 (Occasional Visitor)
Solution

# Re: Conditional Formatting- Greater than multiple cells

a custom formula in conditional formatting will apply the formula to the top left most cell in the 'Applied to' range and then move to each other cell in the range and adjust the formula relative to that next cell location. So lets pretend the gray columns are A:B and you highlight columns C:I and create new rule. Then Enter:
=ISNUMBER(C1)*((C1>\$A1)+(C1>\$B1))
So C1 is the top left corner of the range so If C1 is a number AND > either A1 or B1 it is true
Then when excel looks at D1 it replaces each C1 with D1 in the formula but the \$ before the A and the B tell it to Lock them and not change. And similar when it goes to row 2 all the 1s become 2s.

# Re: Conditional Formatting- Greater than multiple cells

Let's say that the range you want to format conditionally is D2:J50, with the cells in gray in C2:C50

Select D2:J50. The active cell in the selection should be in row 2.

On the Home tab of the ribbon, select Conditional Formatting > New Rule...

Select 'Format only cells that contain'.

Leave the first drop-down set to 'Cell Value'.

Select 'greater than' from the second drop-down.

Enter the formula   =MIN(\$B2:\$C2)   in the box next to it. Remember, B and C are the columns shaded gray, and 2 is the row number of the active cell.

Click Format...

Activate the Fill tab.

Select a color.

Click OK, then click OK again.