Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel conditional formatting with formulas 1

Status
Not open for further replies.

dvirgint

Programmer
Jun 28, 2010
85
CA
Hello,

I've been trying to get this to work for a while now:

I have two cells containing information I have imported from an outside source. The values in each cell should be the same, but if they are not, the cell background color turns red.

It isn't necessary for the cells to be exactly the same - I could have a tolerance level of 2 (cell_value + 2 or cell_value - 2).

I can easily make the cell's background turn red if the numbers must be the same, but how would I go about making it red if the cell value is < 2 or > 2 more than the value of the cell?

So to summarize:

if cell1 = 99
cell2 = 100 the background stays white, but

if cell1 = 99
cell2 = 109 the background turns red

I hope this makes sense.

Thanks for your help.
 


hi,
[tt]
=ABS($A$1-$A$2)<=2
[/tt]


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 


Don't think so.
I could have a tolerance level of 2 (cell_value + 2 or cell_value - 2).

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I'm with Loomah on this one.

The OP wants to turn the cell red if the numbers are sufficiently different. Therefore the conditional formatting condition should be True for differences >2.

So, turn cell red if:
=ABS($A$1-$A$2)>2

Tony
 


yes if it that difference.

Its the PRINCIPLE that matters!

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
No argument about that Skip. You were, of coure, correct (as usual) in telling the OP to use ABS.

Tony
 
Thanks everyone for the great tips. It worked.

Genius, so simple, yet genius.

Thanks all!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top