Is there a BETWEEN function?

A

Arlen

How do you test if a number is equal to or BETWEEN two other numbers, rather
than greater than or equal to the smallest and less than or equal to the
biggest.

Reason being, the smaller number and the larger number may swap cell
addresses at times.

Thanks, all.

Arlen
 
P

Pete_UK

You can use MIN to get the smaller of the two, and MAX for the larger,
so you would have something like:

=IF(AND(A1>=MIN(B1,C1),A1<=MAX(B1,C1)),true_action,false_action)

where B1 and C1 specify the range and either could be the larger, and
A1 is the value you are testing.

Hope this helps.

Pete
 
A

Arlen

Makes sense. Thanks for thinking of it.

Arlen

Pete_UK said:
You can use MIN to get the smaller of the two, and MAX for the larger,
so you would have something like:

=IF(AND(A1>=MIN(B1,C1),A1<=MAX(B1,C1)),true_action,false_action)

where B1 and C1 specify the range and either could be the larger, and
A1 is the value you are testing.

Hope this helps.

Pete
 
S

Sandy Mann

Too late because I'm not a night owl like Pete but just for fun, with the
test number in A1 and the limits in B1 & C1:

=IF(MEDIAN(B1,C1,A1)=A1,"Between or Equal","Not Between")

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk
 
S

Sandy Mann

Never saw your post until after I posted Biff - better still.

--

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk
 

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