# Conditional Formatting help - based on difference between two cells

1. ## Conditional Formatting help - based on difference between two cells

Hi,

I need a formula to highlight a cells in a column based on the difference between two other cells from columns B and D.

E.g. I want it to highlight a cell Green if the difference is 0, Yellow if the difference is 1, Red if the difference is 2 and Blue is the difference is more than 2.

conditional formatting2.xlsx

I have tried using this code but because I am not very good with excel, I am struggling to make it work.

e.g. Highlight green if

=MAX(b1,d1)-MIN(b1,d1)=2

What code do I put in the box please?

Joanne

2. ## Re: Conditional Formatting help - based on difference between two cells

Try

=ABS(\$B2-\$D2)=1

=ABS(\$B2-\$D2)=2

=\$b2=\$d2

3. ## Re: Conditional Formatting help - based on difference between two cells

Strangely, my old formula appears to be working! =MAX(b1,d1)-MIN(b1,d1)=2

4. ## Re: Conditional Formatting help - based on difference between two cells

You can use up to 4 conditional formatting to meet your need. If you have a bunch of rows, you may want to ask for a VBA code to do the job. see the first row.

5. ## Re: Conditional Formatting help - based on difference between two cells

Thank you for taking the time to download and play with my file.

It looks as though it could work. The only problem is, it is the column to the left that I want highlighting. 'End of Year Expectations'

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1