If statement with multiple ifs

S

Sean N.

Not sure if I'm explaining this right but here it goes:

Trying to get an IF statement where if a certain set of data is entered into
a cell the resulting cell will have a certain output:
ie. If A1=Red then b1 would be 1 or if A1=Blue then b1 would be 2, etc.....

Hope someone can help on this!
Thanks,
Sean N
 
M

Max

Use VLOOKUP to simplify things

List all the associations/choices in cols A & B in Sheet2 (say), eg:
Red 1
Blue 2
etc

Then in any other sheet,
assuming the lookup values (Red, Blue) are in A2 down
you can use this in B2: =IF(A2="","",VLOOKUP(A2,Sheet2!A:B,2,0))
Copy B2 down as needed
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:21,000 Files:370 Subscribers:66
xdemechanik
 
S

Shane Devenshire

Hi,

Personally I would usually use a lookup table because it means that if
things change, you can edit the table, a range in the spreadsheet, rather
than a series of formulas.

That said, if you want to store the results in the formula the order would
be more logical if you use VLOOKUP:

=VLOOKUP(A1,{"Red",1;"Blue",2;"Green",3},2,)
 

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