Conditional Formatting based on Two cells Values/Text

justin_n84

Board Regular
Joined
Jan 29, 2017
Messages
59
I am trying to format a cell based on the two cells before it containing YES or NO.

Example, I would like cell A3 to turn green if cell A1 & B1 both contain YES. If A1 contain YES and B1 contains NO then I'd like them to turn red. If neither of these conditions are met then I would like the cell to stay uncoloured.

Once I have done this I would like to be able to drag the condition down so it does the same for cells A2-C2, A3-C3 and so on....

Please Help!!!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
You need two rules. Select columns A and B in their entirety, then create these two rules:

=AND($A1="YES",$B1="NO") - formatted red

=AND($A1="YES",$B1="YES") - formatted green

Done.
 
Upvote 0
Hi, Thanks for the reply.

Could you explain how you carry this out as I have done the above and it doesn't work. Thanks in advance
 
Upvote 0
What do you mean exactly by "it doesn't work"?

Firstly, get rid of any attempts you have made at setting the rule, as they could interfere.

Next select columns A and B by SHIFT-clicking the column headers. With both columns selected, open the CF dialog and create the two rules I have mentioned using the formula option. Do not ignore the dollar signs: if you do, they won't work! Apply your colour formatting in the CF dialog, then save and exit. Now test any pair of cells in the column and you will see the CF kicking in.
 
Upvote 0
For some reason selecting the 2 columns in their entirety didn't work properly. I've done the same thing but just highlight the two cells and then dragged the formatting. That has worked well now. Thanks
 
Upvote 0

Forum statistics

Threads
1,217,381
Messages
6,136,229
Members
450,000
Latest member
jgp19

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