A number to check within a range of 2 nos

hsandeep

Well-known Member
Joined
Dec 6, 2008
Messages
1,215
Office Version
  1. 2010
Platform
  1. Windows
  2. Mobile
I need to judge whether a number falls between a range of 2 numbers.
Ex:
A1=332.024 B1=349.956
C1=335.23 So D1 must give 1 (since between the range) else 0.

If C1=332.02 D1=0
If C1=349.9566 D1=0
If C1=332.024 D1=1
If C1=349.956 D1=1

What formula should be punched in D1?
Thnx in adv
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Thanks. IT WORKS. I am using Weazel's. Is it better then Greg Truby in what sense?
 
Upvote 0
Thanks. IT WORKS. I am using Weazel's. Is it better then Greg Truby in what sense?

I designed mine for good calc speed. Weazel's takes about 30% longer to run. Both yield the same results. Now, having said that - that 30% is really peanuts. I have a 5-year-old notebook with just a dual-core processor and the difference was 510 milliseconds versus 666 milliseconds on 1,000,000 rows (average of three calc runs each using FastExcel). So, unless you're cranking this on either a really, really old machine or a really, really huge number of rows, either formula will yield satisfactory results.
 
Upvote 0
I'll revert back with my Comp's hardware details soon.
 
Upvote 0
If i further expand the range
A1=332.024 B1=349.956 C1=400.997

If D1=335.62 E1=1
If D1=332.024 E1=1
D1=349.956 E1=1
D1=349.957 E1=2
D1=400.998 E1=0
D1=332.001 E1=0

Which formula to be used in E1?
 
Upvote 0
I'm sure one of our power formula gurus will stop by before long and offer up something much more elegant than my hacked solution. But this should work:

• =IFERROR(LOOKUP(D1-(0.000000000001*(D1<>A1)),A1:C1,{1,2,0}),0)
 
Upvote 0

Forum statistics

Threads
1,215,949
Messages
6,127,877
Members
449,410
Latest member
adunn_23

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