Using if statements

K

Kevin Vidrine

I need to do an if statement where the logical test is if
a value is between 0 and 20000, return a value. My problem
is I don't know how to write it. I have tried
if(B15=1<20000,B15*.055,0) Im trying to say in my formula,
if b15 is greater than 1 and less than 20000, multiply the
number in b15 by .055, otherwise return a value of 0. My
formula is not correct. How do I get the logical test to
check for a value between 1 and 20000.
 
J

J.E. McGimpsey

One way:

=IF(AND(B15>1,B15<20000),B15*0.055, 0)

another:

=B15*0.055*(B15>1)*(B15<20000)
 
T

_TWC_Wingnut

Hi Kevin,

Great Question. There are a couple of simple ways to do this.
Remember that the IF statement basically says IF TRUE THEN (DO
SOMETHING) ELSE (DO SOMETHING ELSE)

So, you need IF (B15 >= 0 AND B15 <=2000) THEN B15 ELSE 0

You can write it either:

IF(AND(B15>=0,B15<=20000),B15,0)

Or you can write a "nested IF" statement

IF(B15>=0,IF(B15<=20000,B15,0),0)

They'll both give you the same thing.
 

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