combine or if

L

littlelouise1

I need to check for three (or more conditions) and need a different value
returned for each criteria.

For example:
DATA Wanted result:
1 Single
2 Dual
4 Quad

My mistake lies in formatting of the formula:
If(A1=1, "Single")or if(A1=2, "Dual") or if (A1=4, "Quad")


-aimes
 
P

Peo Sjoblom

You can use

=VLOOKUP(A1,{1,"Single";2,"Dual";3,"Quad"},2,0)

which is handy especially if you use more than 3, or

=CHOOSE(A1,"Single","Dual","Quad")


if you insist using IF


=IF(A1=1,"Single",IF(A1=2,"Dual","Quad"))

assuiming thatn there cannot be any other values than 1,2,3

--


Regards,


Peo Sjoblom
 
G

Gary Brown

=IF(A1=1, "Single",IF(A1=2, "Dual",IF(A1=4, "Quad","")))
--
Hope this helps.
If this post was helpfull, please remember to click on the ''''YES''''
button at the bottom of the screen.
Thanks,
Gary Brown
 
P

Pete_UK

You need to construct your formula like this:

=IF(A1=1,"Single",IF(A1=2,"Dual",IF(A1=4,"Quad","none")))

Will return the message "none" if A1 does not contain 1, 2 or 4.

You can combine IF functions like this (referred to as nesting) up to
a maximum of 7 if you have XL2003 or earlier. An alternative way if
you have more than 7 criteria is to use VLOOKUP, or you could use
CHOOSE if your numbers are consecutive.

Hope this helps.

Pete
 
D

Dave Peterson

I'd create a table on another sheet that's dedicated to just that info.

Then I'd use:

=vlookup(a1,Type!a:b,2,false)

where that table was in A1:B### on a sheet named Type.

If I have to add more entries--or even change some, I find this easier to
update.
 

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