xlookup with multiple results

pete4monc

Board Regular
Joined
Jan 12, 2014
Messages
85
Office Version
  1. 365
Platform
  1. Windows
Hi all

I have two workbooks one with detailed data (Bought-out-part orders) and one with shortened data (BOP Orders).
In workbook BOP Orders, column A, I have our order numbers and I need the formula to look into Bought-out-part orders column A.
Match our order number and pull in the required data from (Bought-out-part orders).
Problem is some orders have multiple items on the same order, I can get it to work until I have multiple rows with the same order number but different item numbers. The formula returns the first row's details correct but then any duplicate items it returns the first line again?
Any idea how I can over come this?
=XLOOKUP($A3,'[Bought-Out-Part Orders.xlsx]Live'!$A$2:$A$336,'[Bought-Out-Part Orders.xlsx]Live'!$D$2:$D$336,0)

Hope this makes sense to you?

Thanks in advance.
Pete
PS: I am running office 365 but some in my team are running Office 2019.
 

Attachments

  • Capture5.PNG
    Capture5.PNG
    185.5 KB · Views: 43

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Does this need to work with xl 2019, as that does not have xlookup?
 
Upvote 0
Ok, how about
Excel Formula:
=INDEX('[Bought-Out-Part Orders.xlsx]Live'!$D$2:$D$336,AGGREGATE(15,6,(ROW('[Bought-Out-Part Orders.xlsx]Live'!$D$2:$D$336)-ROW('[Bought-Out-Part Orders.xlsx]Live'!$D$2)+1)/('[Bought-Out-Part Orders.xlsx]Live'!$A$2:$A$336=$A2),COUNTIFS($A$2:$A2,$A2)))
 
Upvote 0
Solution
Ok, how about
Excel Formula:
=INDEX('[Bought-Out-Part Orders.xlsx]Live'!$D$2:$D$336,AGGREGATE(15,6,(ROW('[Bought-Out-Part Orders.xlsx]Live'!$D$2:$D$336)-ROW('[Bought-Out-Part Orders.xlsx]Live'!$D$2)+1)/('[Bought-Out-Part Orders.xlsx]Live'!$A$2:$A$336=$A2),COUNTIFS($A$2:$A2,$A2)))
Thanks Fluff, that worked a treat.

I'm still relatively new to vba and formulas on excel, but I found I could read you formula and understand most of it but not the "(15,6," bit in the middle. Could you explain what the "(15,6," is?
Just to make you laugh....... I normally trial everything on my laptop before moving it over to our server. When I used this on the server I had issues, then realised the paths were wrong, what a numpty ....lol.
Thanks for your help.
 
Upvote 0
The 15 tells the aggregate function to operate like the small function & the 6 tells it to ignore errors.
 
Upvote 0
The 15 tells the aggregate function to operate like the small function & the 6 tells it to ignore errors.
Aah ok... Thank you! I am very new to VBA and each new success is a great feeling! Thanks for your help Fluff
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,249
Members
449,075
Latest member
staticfluids

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