# Conditional formatting based on adjacent cell

This is a discussion on Conditional formatting based on adjacent cell within the Excel Questions forums, part of the Question Forums category; I am using Excel 2007, I need to highlight in RED cells in a pivot table if the value in ...

1. ## Conditional formatting based on adjacent cell

I am using Excel 2007,

I need to highlight in RED cells in a pivot table if the value in the adjacent cell is less than the referenced cell.

For any row in the Pivot Table
If Cell in column C = 0
and Cell in column D = 1

Cell in column D should be highlighted in RED.

I can't seem to figure out how to refer to the adjacent cell in a conditional format formula.

Can someone help.

2. ## Re: Conditional formatting based on adjacent cell

Select Column D and use the following formula:

=AND(\$C1=0,\$D1=1)

3. ## Re: Conditional formatting based on adjacent cell

A little clarification, D = 1 and C = 0 were only examples. I need to flag column D whenever it's value is greater than column C, regardless of the values.

Example:
D = 5
C = 2

D = 0
C = -1

Sorry for the confusion.

4. ## Re: Conditional formatting based on adjacent cell

OK, so use the formula:

=\$D1>\$C1

5. ## Re: Conditional formatting based on adjacent cell

I don't know about Excel 2007, but in prior versions, just make the formula suit the cell that is active when you are setting up the conditional format.

So, if you select range B2:B100 and the single cell that is active is B2, the formula might be =B2>A2

This (note relative reference) will then apply to all selected cells in the same relative way. You can check after applying it.

If though cell B10 were active, you'd type in =B10>A10

HTH

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•