cell color formatting based on values

hotdogs1999

Board Regular
Joined
Dec 11, 2018
Messages
57
Hello,

i'm after a way to change a cells color based on the value of that cell in relation to the value in an adjoining cell. essentially what the actual value is in relation to the target value.
if the actual value cell is lower than the target value cell then i want it to turn red, and green if its higher than or equal to.

i realise that conditional formatting can be used for this. it works ok for the red option, but when it comes to choosing greater than or equal to on the green option it makes the cell green even if the target value cell is empty (because its equal to the nil value).

is there a better way of doing this?
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Have you tried making the green rule:

Code:
=AND(A1>=B1,B1<>"")
 
Upvote 0
You can use a formula in Conditional Formatting with an AND condition.

Assuming A1 is the cell of interest and B1 is the target, this should work
=AND(A1<>"",B1<>"",A1>=B1)

M.
 
Upvote 0

Forum statistics

Threads
1,223,895
Messages
6,175,257
Members
452,625
Latest member
saadat28

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top