Hlookup to find nearest match then offset to retrieve the value required

swaink

Active Member
Joined
Feb 15, 2002
Messages
432
Evening Everyone

I have been playing with this one for a while now and unable to find a solution, I have seen many references on the board around HLookup & Match but nothing that seems to cover what I am attempting.

I have a table and in Col D I have a list of dimensions in millimeters IE.230 etc

In columns H,I & J I have Banding indicators A, B & C

In columns K, L & M i have boundaries shown in millimeters 600, 800, 1000 this will vary going down the columns

Example: In D2 I have 810, in E2 I want to show the next nearest match from K2 =600, L2=800, M2 = 1000 so in this instance I would expect to pull back 1000

In F2 I then want to pull back a value which is offset in columns H,I &J in this case I would expect to see C

I have hit a wall and struggling to find a workaround and any help would be appreciated
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi there, here's one way that works for me. Note that in column E you have to hit CONTROL+SHIFT+ENTER instead of just enter, as it's an array formula


DEFGHIJKLM
1
2810=MIN(IF(K2:M2>D2,K2:M2))=INDEX(H2:J2,1,MATCH(E2,K2:M2,0))ABC6008001000
3790800BABC6008001000

<colgroup><col width="64" span="11" style="width:48pt"> </colgroup><tbody>
</tbody>


If you want just the one formula, they could be combined as follows (again using control+shift+enter) =INDEX(H2:J2,1,MATCH(MIN(IF(K2:M2>D2,K2:M2)),K2:M2,0))
 
Upvote 0
Hi NiMip

This has been a great help and works exactly as I was aiming for, really appreciate the help thank you :)
 
Upvote 0
Hi Aladin good to hear from you

I tweaked your first formula slightly as I was getting #N/A if D2 was less than K2 but its working fine thank you :)
 
Upvote 0

Forum statistics

Threads
1,215,261
Messages
6,123,946
Members
449,134
Latest member
NickWBA

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