tedious If & or statement

R

Rajula

I have a tedious if statement to be made. What is an easier way of doing it.

If B2 is a or b or c or d or e or f, then a2 is XX
if B2 is g or h or i or j, then a2 is YY
if b2 is k or l or m or n or p, then a2 is ZZ
if b2 is q or r or s or t then a2 is ab
..
..
..
..
..
Is there a way or writing this in a if/or statement??
 
B

Bernard Liengme

I would make a table some place in the workbook with
a XX
b XX
.....
F XX
g YY
etc
Let's say this is in Y1:Z26
Then use =VLOOKUP(B2,Y1:Z26,2,FALSE)

best wishes
 
W

William Horton

Put the below formula in cell A2...

=IF(OR(B2="a",B2="b",B2="c",B2="d",B2="e",B2="f"),"XX",IF(OR(B2="g",B2="h",B2="i",B2="j"),"YY",IF(OR(B2="k",B2="l",B2="m",B2="n",B2="p"),"ZZ",IF(OR(B2="q",B2="r",B2="s",B2="t"),"AB","Other"))))

Hope that helps.
 
R

Rajula

Hi All,

Thanks to all of you for your response.

I chose the Lookup option & i guess thats the best one. And more over my
list will keep growing, so its easier to update the tookup table.

Regards
Rajula
 

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