Search for a number in a range within another range of numbers

cpike

New Member
Joined
Jun 13, 2015
Messages
5
Hi,

I have two sets of numerical data that I am trying to match if a alphanumeric criteria is met.

Both ranges are numeric (from and to depth measurements)
The first range is continuous, From_L will always equal the previous To_L

The second range (From_S & To_S) may not be continuous but there will be no overlapping values.

I need to flag any To_S value that falls within a From_L - To_L range that has the Type LO

I've noted the From_S - To_S range that meets the criteria in the table - marked with FAIL
Note that the two ranges are variable, the range values will rarely match and they won't often be in the same row.

From_LTo_LTypeFrom_STo_S
010.5QQ8.09.0OK
10.511.5LO9.010.2OK
11.525.6QN10.210.9FAIL
25.655.1VV

<tbody>
</tbody>

Any help would be greatly appreciated!!

Thanks
Christian
 
Last edited:

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Why are you lining up the red "10.2 10.9 FAIL" data with the red "10.5 11.5 LO" and not "0 10.5 QQ"
The "S" data being checked overlaps two lines of "L" data
 
Upvote 0
Why are you lining up the red "10.2 10.9 FAIL" data with the red "10.5 11.5 LO" and not "0 10.5 QQ"
The "S" data being checked overlaps two lines of "L" data

I'm only looking for any To_S that falls within a From_L and To_L range with the Type LO

So in the example I need to flag any To_S that is between >10.5 and <=11.5
 
Upvote 0
I'm only looking for any To_S that falls within a From_L and To_L range with the Type LO

So in the example I need to flag any To_S that is between >10.5 and <=11.5

Why do you have OK for the other To_S entries? These are not associated with Type LO...
 
Upvote 0
Why do you have OK for the other To_S entries? These are not associated with Type LO...

Hi Aladin,
I just put the OK there to indicate that those ranges do not match the LO range.
In the task that I am doing those ranges are valid.

I need to prevent users from adding any number range that is within a Type LO range.
I don't want users to create From_S - To_S ranges that fall within a range that contains the Type LO
 
Upvote 0
One set of number ranges is created first (shown as First Ranges below).

First Ranges
From_LTo_LType
010.5QQ
10.511.5LO
11.525.6QN

<tbody>
</tbody>








Then users create another range.
I need to flag any To_S value that falls within any range from the First Ranges (above) that has the type LO

Second Ranges

From_STo_SValid/Not Valid
8.09.0VALID
9.010.2VALID
10.210.9NOT VALID

<tbody>
</tbody>








I hope this makes more sense
 
Last edited:
Upvote 0
Let A1:C4 house 'First Ranges' and F1:H4 'Second Ranges', with headers in the first row.

In H2 control+shift+enter, not just enter, and copy down:
Rich (BB code):

=IF(ISNUMBER(MATCH(1,IF($C$2:$C$4="LO",IF(G2>=$A$2:$A$4,
   IF(G2<=$B$2:$B$4,1))),0)),"NOT VALID","VALID")
 
Upvote 0
Let A1:C4 house 'First Ranges' and F1:H4 'Second Ranges', with headers in the first row.

In H2 control+shift+enter, not just enter, and copy down:
Rich (BB code):

=IF(ISNUMBER(MATCH(1,IF($C$2:$C$4="LO",IF(G2>=$A$2:$A$4,
   IF(G2<=$B$2:$B$4,1))),0)),"NOT VALID","VALID")

Thanks Aladin!
I've done a bit of testing with it and it seems to work nicely, very much appreciated!
 
Upvote 0
If "From S" is in E1, perhaps this in G2

=IF(0=SUMPRODUCT(--(($A$2:$A$5<=E2:F2)*(E2:F2<=$B$2:$B$5))*($C$2:$C$5="LO")),"OK","fail")
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,393
Members
449,081
Latest member
JAMES KECULAH

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