I AM TRYING TO USE BETWEEN IN IF THEN ELSE

G

Guest

how do i use between instead of greater than or less than , in if then else
statement
 
A

Ardus Petus

To test A1 againts range 100,200:

=IF(AND(A1<=100,A1<=200),"In range","out range")

There is no "between" operator.

HTH
 
D

David Biddulph

aries said:
how do i use between instead of greater than or less than , in if then
else
statement

If you're looking for A1 to be between B1 and C1, try
=IF(AND(A1>B1,A1<C1),D1,E1)
 
H

Harlan Grove

aries wrote...
how do i use between instead of greater than or less than , in if then else
statement

Excel lacks SQL's BETWEEN operator, but if you really can't use < or >
for whatever reason, you could try something like

="x "&IF(MEDIAN(x,a,b)=x,"","not ")&"between a and b"
 
G

Guest

Interesting. I modified it slightly so I could test it and it performed as
expected:

=C4&IF(MEDIAN(C4,A4,B4)=C4,""," not ")&" between " & A4 & " and " & B4

You learn something new every day (or in my case, every other day.)
 

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