Xlookup/Index Match With Multiple Criteria

acool

Board Regular
Joined
Feb 10, 2023
Messages
117
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

I am try to create a formula in Cells H2:H5, that will search values in cell D2:D5 and match them up against values in the lookup table in column F to return the corresponding value. I would first like to remove leading zeros from the comma delimited values in Column D. I would then like to search the comma delimited values in column D against Column F and then provided that corresponding value in Column H if it exists in the table. Any help would be greatly appreciated. I have attached a photo below for reference. Thank You!
1715798616291.png
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try this:

=--(MAP(D2:D5,F2:F5,LAMBDA(a,b,IF(ISNUMBER(SEARCH(b,a))=TRUE,MID(a,SEARCH(b,a),LEN(b))))))
 
Upvote 0
@hagia_sofia This works! However, if you don't mind me asking, what changes would need to be made to the formula if there table arrays were different range sizes? For example, if Column F was longer than Column D Range?
 
Upvote 0
@hagia_sofia This works! However, if you don't mind me asking, what changes would need to be made to the formula if there table arrays were different range sizes? For example, if Column F was longer than Column D Range?
In many scenarios, my lookup table will be either longer or shorter than the values column.
 
Upvote 0
How about this then:

=LET(values,--(TRANSPOSE(TEXTSPLIT(TEXTJOIN(", ",,D2:D5),", "))),XLOOKUP(F2:F5,values,values))
 
Upvote 0
How about this then:

=LET(values,--(TRANSPOSE(TEXTSPLIT(TEXTJOIN(", ",,D2:D5),", "))),XLOOKUP(F2:F5,values,values))
@hagia_sofia Apologies, ***Values in Column D will be longer than the Lookup Values in Column G So if one of the values in Column D corresponds to G, return that value in Column E. As of now, it is only populating to row 9. Apologies for the confusion, and thank you for all of your help up until this point!

1715808068538.png
 
Upvote 0
I still do not know whether I understand it correctly but let us give it a shot:

=LET(lookup,G2:G9,BYROW(D2:D16,LAMBDA(a,TEXTJOIN(", ",,XLOOKUP(--(TEXTSPLIT(TEXTJOIN(", ",,a);", ")),lookup,lookup,"")))))
 
Upvote 0
I see that I forgot to replace one semicolon with comma (I am not using English Excel) - here it is adjusted:

=LET(lookup,G2:G9,BYROW(D2:D16,LAMBDA(a,TEXTJOIN(", ",,XLOOKUP(--(TEXTSPLIT(TEXTJOIN(", ",,a),", ")),lookup,lookup,"")))))
 
Upvote 0
Solution
I see that I forgot to replace one semicolon with comma (I am not using English Excel) - here it is adjusted:

=LET(lookup,G2:G9,BYROW(D2:D16,LAMBDA(a,TEXTJOIN(", ",,XLOOKUP(--(TEXTSPLIT(TEXTJOIN(", ",,a),", ")),lookup,lookup,"")))))
This worked! You're the best-thank you!
 
Upvote 0

Forum statistics

Threads
1,217,286
Messages
6,135,645
Members
449,954
Latest member
brcs89

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