IF AND statement

L

Lupe

Hi, I need to check on 2 columns to give me the following.
If G2 <= 0 and P2 <> 12 "do nothing".
If G2 <=0 and P2 = 12 "incorrect"
If G2 > 0 and P2 = 12 "correct"
Here is my formula, but it does not work. I am sure missing something but I
cannot see it.
=IF($G2<=0,IF(AND($P2<>12),"do
nothing",IF(AND($P2=12),"incorrect","correct")))
Thanks, Lupe
 
D

Don Guillett

Let's see
if(g2<=0,cond1,cond2)
cond1 if(p2=12,"i","")
cond2 if(p2=12,"c","")

OR keys on p2 first

=IF(p2=12,IF(g2<=0,"i","c"),"")
 
L

Lupe

Thanks you Teethless mama.
I have added and changed it a little bit to better reflect what we needed
and it works:
=IF(AND($G3<=0,$P3=12),"change to
01",IF(AND($G3>0,$P3=12),"correct",IF(AND($G3>0,$P3<>12),"change to 12","do
nothing")))
 
L

Lupe

Don,
I'm leaving the office at the moment but I will check tomorrow whether this
statement also works for me.
Thanks, Lupe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top