Check if decimal/float value is between two values

vanclute

Board Regular
Joined
Oct 23, 2002
Messages
218
Hi all, apologies if this has been answered as the forum software won't allow searches for the word "between"!

I need to check if a monetary value (2 decimal places) is between two numbers. I've been using the usual if(and()) approach but it's sooooo clunky. I found the MEDIAN approach and like it, but it only seems to work for integers.

Is there a tidy way to evaluate if a decimal value is between two other (potentially also decimal) values?

Thanks!

EDIT: I may have been mistaken about the MEDIAN approach only supporting integers, I think I just did it wrong. Still I'd be interested to know if anyone has any other clever solutions to this.
 
Last edited:

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi all, apologies if this has been answered as the forum software won't allow searches for the word "between"!

I need to check if a monetary value (2 decimal places) is between two numbers. I've been using the usual if(and()) approach but it's sooooo clunky. I found the MEDIAN approach and like it, but it only seems to work for integers.

Is there a tidy way to evaluate if a decimal value is between two other (potentially also decimal) values?

EDIT: I may have been mistaken about the MEDIAN approach only supporting integers, I think I just did it wrong. Still I'd be interested to know if anyone has any other clever solutions to this.
Assuming two decimal point accuracy, Round all values to two point accuracy in the formula. For example...

=MEDIAN(ROUND(A1,2),ROUND(B1,2),ROUND(C1,2))=ROUND(B1,2)
 
Upvote 0
Thanks for that, though I don't think it's any shorter or more efficient than using the "and" method or my current MEDIAN approach, which is:

=IF([@plRPM]=MEDIAN([@plRPM],$O$2,$O$3),TRUE,FALSE)

I'm noticing however that my use of this calculation on a fairly large spreadsheet, is quite slow. Wondering if there's a faster solution.
 
Upvote 0

Forum statistics

Threads
1,216,562
Messages
6,131,422
Members
449,651
Latest member
Jacobs22

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top