How to express this in an if statement.

K

kevin

I hope someone might be able to show me how to express the following in an IF
statement. =if(a1 is between 0 and 3 then "low", if(a1 is between 4 and 6
then "medium", if(a1 is between 7 and 10 then "high", if(a1>10 then
"extreme", "")
 
J

JE McGimpsey

One way:

If one can assume that there will be no numbers < 0, and that all
numbers are integers:

=LOOKUP(A1,{0,4,7,11},{"low","medium","high","extreme"})

(otherwise, you need to specify what happens for negative numbers and
non-integers, like 6.5)

As an IF() statement:


Strictly:

=IF(AND(A1>=0,A1<=3),"low",IF(AND(A1>=4,A1<=6),"medium",
IF(AND(A1>=7,A1<=10),"high",IF(A1>10,"extreme","something else"))))

or, using the above assumptions:

=IF(A1<=3,"low",IF(A1<=6,"medium",IF(A1<=10,"high","extreme")))
 
N

Niek Otten

Hi Kevin,

You don't tell what it has to be if A1<0, what if it is 3.5, etc, but this
may help:

=IF(A1<4,"low",IF(A1<7,"medium",IF(A1<11,"high","extreme")))

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel
 
K

kevin

Thanks very much for your help, works great.

Niek Otten said:
Hi Kevin,

You don't tell what it has to be if A1<0, what if it is 3.5, etc, but this
may help:

=IF(A1<4,"low",IF(A1<7,"medium",IF(A1<11,"high","extreme")))

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel
 

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