Formula to determine what range an item/value falls within

cvrband

Board Regular
Joined
Jan 6, 2016
Messages
63
Office Version
  1. 365
Platform
  1. Windows
Greetings - Please see the 3 examples below. I'm looking for a formula (if possible) to determine what range an item falls within and return the range number in the "Range Result" column. In my actual spreadsheet, the Item List is a named range (for this example call it 'ItemList'), the range numbers always start at 1 and are sequential (could be 20 or more ranges in total), and the min/max values and the total number of ranges are based on user input. Range 1's minimum value should be the first item in the list and the last range's max value should be the last item in the list. Thanks in advance!


Value in Range.xlsx
ABCDEFGHIJKLMNOPQRSTUV
1
2EXAMPLE AEXAMPLE BEXAMPLE C
3ItemRangeItemRangeItemRange
4ListResultRangeMinMaxListResultRangeMinMaxListResultRangeMinMax
5LWT111LWT12DWT11DWT211112
6LWT212371123621236
7113892137932379
821410RWT32410134241012
932425141552513WWT3
1042526161862
11526273
12627383
13728393
148393104
1593104114
16104114124
17114124135
18124134WWT25
19134145WWT35
20RWT4155
21166
22176
23186
24
Sheet1
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi, something like this maybe?

Book1
ABCDEF
1
2EXAMPLE A
3ItemRange
4ListResultRangeMinMax
5LWT111LWT12
6LWT21237
711389
821410RWT
932
1042
1152
1262
1372
1483
1593
16104
17114
18124
19134
20RWT4
Sheet1
Cell Formulas
RangeFormula
E5:E8E5=XLOOKUP($D5,$B$5:$B$20,$A$5:$A$20,"",0,1)
F5:F8F5=XLOOKUP($D5,$B$5:$B$20,$A$5:$A$20,"",0,-1)
 
Upvote 0
An enhancement to FormR's solution.

D5
Excel Formula:
=UNIQUE(B5:B20)
E5
Excel Formula:
=XLOOKUP(D5#,B5:B20,A5:A20,,0,{1.-1})
 
Upvote 0
Hello FormR - Thanks for your reply. Maybe I wasn't clear but I'm looking for the formula to return the results as shown in columns B, J, and R. The formula would be located in say B5# and look up the item in column A to determine which range the Item falls within in columns E & F returning that range's value from Column D. My columns B, J, and R are examples of what the formula should return.
 
Upvote 0
Then try this.
Excel Formula:
=XLOOKUP(ROWS(B$5:B5),XMATCH($E$5:$E$8,$A$5:$A$20,0),$D$5:$D$8,,-1,1)
 
Upvote 0
Solution

Forum statistics

Threads
1,224,844
Messages
6,181,294
Members
453,030
Latest member
PG626

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