Conditional Formatting with 3 cell [Solved/Closed]

Report
-
Posts
4475
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
January 6, 2016
-
Hi all

I want to do conditional formatting a cell but based on the criteria set by 2 other sells in the row

so if A1 = 0 and B1 > 0

i want C1 (or whatever cell) to say Yes or something?

what VBA can I use?


thanks in advance

5 replies

Posts
4475
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
January 6, 2016
757
I dont get it. Where is formatting involved in this. It seem that all you want is to have C1 populated based on A1 and B1

=IF(AND(A1=0, B1>0), "Yes", "No")
i feel like an idiot thanks alot for your help
Posts
4475
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
January 6, 2016
757
how do you know how an idiot feels like :P

You are welcome and thanks for being polite enough to post feedback. There are only few who take pains to do that and for that I thank you.
lol not the first time

anyways could i ask you another question?

i got the 2 cells A1 and B1

i want to populate C3 with a "yes" if they are BOTH >1 and a "no" if they are both = 0
Posts
4475
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
January 6, 2016
757
First to teach you how to fish :)

if statement is like this

=IF(condition, show this when true, show this when false)

you can have up to 7 nested if

=IF(condition, true, IF(condition 2, true, false))
=IF(condition, if(condition 3, true, false), IF(condition 2, true, false))

for conditions you can use AND and OR if there are multiple condition
a1=5, and b4=10
=IF(AND(A1=5, b4=10), true, false)

a1=5 or b4 = 10
IF(OR(A1=5, b4=10), true and false)

NOW for your question
=IF(AND(a1>1, B1>1), "yes", IF(AND(A1=0, b1=0, A1<>"", B1<>""), "No", ""))
this says if both a1and b1> 1 then show yes
if both a1 and b1 = 0 and not equal to "" then show no. The reason for check for "" is if cell is blank, a1 will be evaluated as 0, so in case it is not desired
if neither conditions are met then show ""

You could have written same as (which is harder to understand)

=IF(A1>1, IF(B1>1, "Yes", ""), IF(A1=0, IF(A1<>"", IF(B1=0, IF(B1<>"", "no", ""),""),""),""))