# How do I get MS Excel "IF" function to work with three variables?

I can't get this formula to work?
=IF(E17=1,">> YES <<",IF(E17>=2,">> NO <<", IF(E17=3," >> N/A <<")))
###### Who is Participating?

EngineerCommented:
change

E17>=2

to

E17=2
0

Commented:
if you're dealing with E17 being 1, 2, or 3, you can simplify, using the choose statement,

For example:

=CHOOSE(E17,">> YES <<",">> NO <<"," >> N/A <<")  yes, for 1  no for 2, and n/a for 3

you can put an IFERROR around that or IF(ISERROR in 2000-2003 if you want to trap values other than 1,2, or 3.

Dave
0

Commented:
You should change the order of conditions:

=IF(E17=1,">> YES <<",IF(E17=3," >> N/A <<",IF(E17>=2,">> NO <<")))

Regards,
Davy
0

Excel VBA DeveloperCommented:
The CHOOSE function is best.

Another way to avoid having an error returned would be to add data validation to cell E17 to only allow values of 1,2, or 3 in that cell.

Also, what value would you want returned if E17 is blank?  That's a case where the IFERROR function (in Excel 2007) or IF(ISERROR()) nested functions (in Excel 2003) would be helpful.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.