Excel - Conditional formatting for two values

Kawule

New Member
Joined
Nov 21, 2016
Messages
23
I'm trying to find out why my 2nd conditional formatting does not work.

Basically on my sheet there is a column where the pH must be greater than 6.5 and less than 8.5 (Looks like 6.5 > pH < 8.5)

The conditional formatting is applied to the next column over for the sake of simplicity lets say this is column B which has its own IF statement to print out OK if true, Bad if False

So my first one I wrote it like this:
=AND(A5>=6.5,A5<=8.5) and this will set the cell colour to green if I put in say 7 for pH, this is applied to Column B starting @ B5

The second one I wrote it like this:
=AND(A5<6.5,A5>8.5) and its supposed to set the colour to red, this also applies to Column B starting @ B5 however, I think there is something wrong with the logic on this one which is maybe why it doesn't work.
 
Last edited:

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Yeah, a value can't be less than 6.5 AND at the same time be greater than 8.5!
Use OR instead:
Code:
[COLOR=#333333]=[/COLOR][COLOR=#ff0000]OR[/COLOR][COLOR=#333333](A5<6.5,A5>8.5)[/COLOR]
 
Upvote 0
I'll give that a shot and also would this logic work? =AND(A5<>6.5,A5<>8.5) if I used that I think it might work but I have a feeling that would cause some issues

EDIT: Your suggestion worked thanks! Logic in programming always confuses me lol
 
Last edited:
Upvote 0
=AND(A5<>6.5,A5<>8.5) would ALWAYS return TRUE!
Translated it would sound something like this:
different from 6.5 AND different from 8.5
To return FALSE the value in A5 would need to be both 6.5 AND 8.5 which is impossible!
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,715
Members
448,985
Latest member
chocbudda

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