if...or...Function

M

Mgt

I need to create a function that says:

If cell x is either 2,4,6,or 8, then type 'blue' in cell y
and if cell x is either 1,3,5 or 7, then enter 'yellow' in cell y
and if cell x is either 10,12,14,or 16, then enter 'green' in cell y
etc....
 
D

Don Guillett

If vba use SELECT CASE
select case =cell x
case =1,3,5,7: mc=yellow
case=2,etc
case else
end select
cell y=mc
 
M

Mgt

I guess I need more info (sorry)
what is vba?
how do I select case--I can't find this option in Excel....
 
D

Don Guillett

In your case it would probably be easier for you to use a LOOKUP function
from a list. Look in Help index for LOOKUP.
 
J

JulieD

Hi

Depending on how many options you had here's one solution
=IF(AND(A6>1,A6<10,MOD(A6,2)=0),"blue",IF(AND(A6<10,MOD(A6,2)<>0),"yellow",IF(AND(A6>=10,A6<20,MOD(A6,2)=0),"green",IF(AND(A6<20,MOD(A6,2)<>0),"orange","another
colour"))))

but remember you can only nest 7 IF functions.

Cheers
JulieD
 

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