Look-up with multiple conditions (including a NEAREST value look-up)

BWilson

New Member
Joined
Dec 14, 2011
Messages
18
Office Version
  1. 365
Platform
  1. Windows
Hi,
There's lots of info about looking up a value with multiple criteria (vlookup with helper function, xlooup, index-match, etc). I can get this to for exact-match look ups, but I can't figure it out when one variable requires a nearest value look-up.

In the example below, I have my data on the left (Object and Size), and I need to pick the object category based on the table on the right (ObjCat, Object, MinSize). I can get the look-up with the Object just fine, but how can I write a formula that ALSO uses a nearest-value look-up with the Size? In this case, nearest value being the next smallest. I can sort the tables by size if necessary.

ObjectSizeLOOK_UP RESULTObjCatObjectMinSize
A3A_Sml
A10A_MedA_SmlA1
B2B_SmlA_MedA10
B4B_SmlA_BigA20
C15C_MedB_SmlB1
C35C_BigB_MedB5
B_BigB10
C_SmlC1
C_MedC10
C_BigC30

Thanks!

-B
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
What version of Excel are you using?
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
Office 365, Windows. Updated my account details.
 
Upvote 0
Thanks for that. (y)
How about
Fluff.xlsm
ABCDEFG
1ObjectSizeLOOK_UP RESULTObjCatObjectMinSize
2A3A_Sml
3A10A_MedA_SmlA1
4B2B_SmlA_MedA10
5B4B_SmlA_BigA20
6C15C_MedB_SmlB1
7C35C_BigB_MedB5
8B_BigB10
9C_SmlC1
10C_MedC10
11C_BigC30
Master
Cell Formulas
RangeFormula
C2:C7C2=TAKE(FILTER($E$3:$E$11,($F$3:$F$11=A2)*($G$3:$G$11<=B2)),-1)
 
Upvote 0
Solution
Thanks for that. (y)
How about
Fluff.xlsm
ABCDEFG
1ObjectSizeLOOK_UP RESULTObjCatObjectMinSize
2A3A_Sml
3A10A_MedA_SmlA1
4B2B_SmlA_MedA10
5B4B_SmlA_BigA20
6C15C_MedB_SmlB1
7C35C_BigB_MedB5
8B_BigB10
9C_SmlC1
10C_MedC10
11C_BigC30
Master
Cell Formulas
RangeFormula
C2:C7C2=TAKE(FILTER($E$3:$E$11,($F$3:$F$11=A2)*($G$3:$G$11<=B2)),-1)
Logically your solution makes sense. Unfortunately, when I tried implementing it in my own spreadsheet and I'm getting a #VALUE! return. With a little troubleshooting, I find the first half of the filter (range = cell) works fine, but the (range <= cell) part is causing the problem. Did it work for you?
I've also found a workaround with my dataset, unrelated to my question. So I won't spend much more time on this forum thread, but will mark you solution as correct if the formula is valid for the sample dataset (where my spreadsheet could have a different problem.)
 
Upvote 0

Forum statistics

Threads
1,214,780
Messages
6,121,527
Members
449,037
Latest member
tmmotairi

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