Xlook-up with multiple columns and one column being a range look-up

BryantK

New Member
Joined
Sep 1, 2022
Messages
5
Office Version
  1. 365
Platform
  1. Windows
I've included an example, but my issue is getting an Xlook-up formula to work when you need to exact match for 3 columns and a range look-up for the 4th column.

The formula that I'm using right now is =XLOOKUP(I1&I2&I3&I4,A:A&B:B&C:C&D:D,F:F,,-1) and the issue for the margin look-up to the far right is when I put 5,500 for the Quantity it returns the 500 quantity margin. It's almost like the exact match of the 1st digit takes precedent in the look-up over the next 3 digits of 5,500.

Is there another way to go about this or do I need to combine multiple X-lookups?

Thanks!

Group1Group2Group3Quantity FROMQuantity ToMARGINGroup1AMargin
40%
AAA-24
5.0%​
Group2A
AAA2549
10.0%​
Group3A
AAA5099
15.0%​
Quantity5,500
AAA100199
20.0%​
AAA200299
25.0%​
AAA300399
30.0%​
AAA400499
35.0%​
AAA500999
40.0%​
AAA1,0001,999
45.0%​
AAA2,0003,999
50.0%​
AAA4,0005,999
55.0%​
AAA6,0009,999
60.0%​
AAA10,00016,000
65.0%​
AAA16,00119,999
70.0%​
AAA20,00029,999
75.0%​
AAA30,00039,999
80.0%​
ABB-24
5.0%​
ABB2549
10.0%​
ABB5099
15.0%​
ABB100199
20.0%​
ABB200299
25.0%​
ABB300399
30.0%​
ABB400499
35.0%​
ABB500999
40.0%​
ABB1,0001,999
45.0%​
ABB2,0003,999
50.0%​
ABB4,0005,999
55.0%​
ABB6,0009,999
60.0%​
ABB10,00016,000
65.0%​
ABB16,00119,999
70.0%​
ABB20,00029,999
75.0%​
ABB30,00039,999
80.0%​
BAA-24
5.0%​
BAA2549
10.0%​
BAA5099
15.0%​
BAA100199
20.0%​
BAA200299
25.0%​
BAA300399
30.0%​
BAA400499
35.0%​
BAA500999
40.0%​
BAA1,0001,999
45.0%​
BAA2,0003,999
50.0%​
BAA4,0005,999
55.0%​
BAA6,0009,999
60.0%​
BAA10,00016,000
65.0%​
BAA16,00119,999
70.0%​
BAA20,00029,999
75.0%​
BAA30,00039,999
80.0%​
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
You could do this using xlookup

=XLOOKUP(1,(A2:A100=I1)*(B2:B100=I2)*(C2:C100=I3)*(D2:D100<=I4)*(E2:E100>=I4),F2:F100,,0)
 
Upvote 0
Solution
One last question - Is there a look-up cap on the amount of rows with this formula? I have around 800 rows and the formula doesn't seem to work for anything beyond row 475. When I changed the sort and move the items returning an "#N/A" to the beginning, then the data works.

Here's the formula that I used:

=XLOOKUP(1,(Margin!$A:$A=Summary!B1)*('Base Price'!$B:$B=Summary!B2)*(Margin!$C:$C=Summary!B3)*(Margin!$D:$D<=Summary!B6)*(Margin!$E:$E>=Summary!B6),Margin!$F:$F,,0)
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,263
Members
452,627
Latest member
KitkatToby

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