• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

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 <<")))
0
cssc1
Asked:
cssc1
4 Solutions
 
Saqib Husain, SyedEngineerCommented:
change

E17>=2

to

E17=2
0
 
dlmilleCommented:
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
 
Davy2270Commented:
You should change the order of conditions:

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


Regards,
Davy
0
 
Glenn RayExcel 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

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now