If statements

M

Mark.M.Sweeney

I want an IF statement that would be able to do the following:

IF cell A6 is between 1 and 4 then put "A" in cell A7
IF cell A6 is between 5 and 8 then put "B" in cell A7
IF cell A6 is between 9 and 12 then put "C" in cell A7
IF cell A6 is between 13 and 16 then put "D" in cell A7
IF cell A6 is between 17 and 20 then put "E" in cell A7


Any idea how I could do this?

Thank you in advance, Mark
 
G

Gord Dibben

I assume you mean 1 and 4, not between 1 and 4

=LOOKUP(A6,{1,5,9,13,17,21},{"A","B","C","D","E","over20"})


Gord Dibben MS Excel MVP
 
M

Mark.M.Sweeney

One way
=CHAR(LOOKUP(D55,{1,5,9,13,17},{65,66,67,68,69}))
--
Don Guillett
Microsoft MVP Excel
SalesAid Software








- Show quoted text -

Thank you, I put it together without the =CHAR part and it worked
fine. I don't know what the =CHAR part does, would it help?
 
D

Don Guillett

char(65) is a capital A
Look in the help index for CHAR

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
[email protected]
One way
=CHAR(LOOKUP(D55,{1,5,9,13,17},{65,66,67,68,69}))
--
Don Guillett
Microsoft MVP Excel
SalesAid Software








- Show quoted text -

Thank you, I put it together without the =CHAR part and it worked
fine. I don't know what the =CHAR part does, would it help?
 
R

Rick Rothstein \(MVP - VB\)

Depending on if A6 always has a number in it and how high you wanted that
number to be able to go (you can control these with an IF function call if
necessary)...

=CHAR(65+INT((A6-1)/4))

Rick
 
R

Ray

I'm no expert like some of these other guys but this is what I would do. I
don't know what you want in A7 if A6 is blank or = 0, or if it is greater
than 20, but this formula placed in cell A7 would accomplish what you want:

=IF(A6<1,"",IF(A6<=4,"A",IF(A6<=8,"B",IF(A6<=12,"C",IF(A6<=16,"D",IF(A6<=20,"E",""))))))
 
Top