nested if(and(3 arguments inside)

N

natalia

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
 
M

Michael

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(..
 
G

Gerry

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
 
J

Jerry W. Lewis

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
 

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

Similar Threads


Top