nested if(and(3 arguments inside)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I am not sure why this formual is not working, meaning it does not pull the "2" for some of my records that meet the criteria of E2>0,F2>0,G2>0. Is this because I can use only two arguments within the if(and(..
It does pull correctly "1","3",'0"

=IF(AND(E2>0,F2>0),"1",IF(AND(E2>0,G2>0),"3",IF(AND(E2>0,F2>0,G2>0),"2","0"))

Any idea? What should I change!?

Thank you for your help

Regards. Natalia
 
Hi Natalie
The way you have the formula set up will never allow it to
reach the 3rd If statement.
Try it this way around:

=IF(AND(E2>0,F2>0,G2>0),"2",IF(AND(E2>0,F2>0),"1",IF(AND
(E2>0,G2>0),"3","0")))

Regards
Michael
-----Original Message-----
Hello,

I am not sure why this formual is not working, meaning it
does not pull the "2" for some of my records that meet the
criteria of E2>0,F2>0,G2>0. Is this because I can use only
two arguments within the if(and(..
 
Natalia,
The 1st argument has been met so It will stop looking.

If 1st argument is true, 1, all other arguments become false
If 1st argument is false, and 2nd argument is true, 3, all other arguments become false
try:
=IF(AND(E2>0,F2>0,G2>0),"2",IF(AND(E2>0,G2>0),"3",IF(AND(E2>0,F2>0),"1","0")))
Gerry
----- natalia wrote: -----

Hello,

I am not sure why this formual is not working, meaning it does not pull the "2" for some of my records that meet the criteria of E2>0,F2>0,G2>0. Is this because I can use only two arguments within the if(and(..
It does pull correctly "1","3",'0".

=IF(AND(E2>0,F2>0),"1",IF(AND(E2>0,G2>0),"3",IF(AND(E2>0,F2>0,G2>0),"2","0")))

Any idea? What should I change!?

Thank you for your help.

Regards. Natalia
 
When you want "2", your first condition is also true, so you never get
to the third condition. Try

=IF(AND(E2>0,F2>0,G2>0),"2",IF(AND(E2>0,F2>0),"1",IF(AND(E2>0,G2>0),"3","0")))

Jerry
 
Back
Top