VLOOKUP or XLOOKUP Partial match formula help

sbutler66

New Member
Joined
Apr 2, 2024
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm looking to update prices for a large export of products. I need to map the pricing from one sheet containing the top level product SKUs, to the sheet prepared for import which contains longer Product variation SKUs.

For example the Product SKU in the price sheet would be 1234567, and in the upload sheet with the SKU variants, they would be 1234567RED, 1234567BLUE and so on.

I would like to map using the Product variant SKUs. However, I'm having issues getting the formula to correctly identify and match the SKUs in the arrays.

I'd like to write a formula to match for the initial partial numerical match, how would I do this? Furthermore, would you suggest VLOOKUP or XLOOKUP?

I've attached a simplified version below for illustration:

Screenshot 2024-04-02 143025.png


Thanks in advance!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Are the SKU numbers always the same length?
 
Upvote 0
try this:
Book2
ABCDEFG
1PRODUCTSKUPRICEProductVariantSKUPrice
2Product110934323001093432RED300
3Product210934474001093432BLUE300
4Product310934495001093447RED400
51093447BLUE400
61093449RED500
71093449BLUE500
Sheet2
Cell Formulas
RangeFormula
G2:G7G2=XLOOKUP(1*LEFT(F2,7),$B$2:$B$4,$C$2:$C$4,"Not Found",0)
 
Upvote 0
Adapting on @awoohaw answer, you can make the formula spill by grabbing the entire range.

Book3
ABCDEFGH
1PRODUCTSKUPRICEProductVariantSKUPrice
2Product110934323001093432RED300
3Product210934474001093432BLUE300
4Product310934495001093447RED400
51093447BLUE400
61093449RED500
71093449BLUE500
8
Sheet3
Cell Formulas
RangeFormula
G2:G7G2=XLOOKUP(1*LEFT(F2:F7,7),$B$2:$B$4,$C$2:$C$4,"Not Found",0)
Dynamic array formulas.
 
Upvote 0
try this:
Book2
ABCDEFG
1PRODUCTSKUPRICEProductVariantSKUPrice
2Product110934323001093432RED300
3Product210934474001093432BLUE300
4Product310934495001093447RED400
51093447BLUE400
61093449RED500
71093449BLUE500
Sheet2
Cell Formulas
RangeFormula
G2:G7G2=XLOOKUP(1*LEFT(F2,7),$B$2:$B$4,$C$2:$C$4,"Not Found",0)
Wow, thank you, this works perfectly for my mini example.

To extrapolate to my larger worksheets, I would expand the ranges for column B & C?

Columns F & G from above are currently in a separate worksheet in my working files, would it be easier to copy into a single sheet to fit his formula?
 
Upvote 0
are you asking for all three columns to get returned? Then the functions can be changed a little bit.

The other worksheet needs to be open when you do these calculations.

If you want to avoid having the worksheet open you could link your source table to the current workbook with POWER QUERY.

But, try this for a quick result, and yes you need adjust your ranges.

Book2
ABCDEFGHI
1PRODUCTSKUPRICEProductVariantSKU
2Product110934323001093432REDProduct11093432300
3Product210934474001093432BLUEProduct11093432300
4Product310934495001093447REDProduct21093447400
51093447BLUEProduct21093447400
61093449REDProduct31093449500
71093449BLUEProduct31093449500
Sheet2
Cell Formulas
RangeFormula
G2:I7G2=LET(Prods,$A$2:$C$4,SKUS,$B$2:$B$4,sku,1*LEFT($F2,7),FILTER(Prods,SKUS=sku,"not found"))
Dynamic array formulas.
 
Last edited:
Upvote 0
are you asking for all three columns to get returned? Then the functions can be changed a little bit.

The other worksheet needs to be open when you do these calculations.

If you want to avoid having the worksheet open you could link your source table to the current workbook with POWER QUERY.

But, try this for a quick result, and yes you need adjust your ranges.

Book2
ABCDEFGHI
1PRODUCTSKUPRICEProductVariantSKU
2Product110934323001093432REDProduct11093432300
3Product210934474001093432BLUEProduct11093432300
4Product310934495001093447REDProduct21093447400
51093447BLUEProduct21093447400
61093449REDProduct31093449500
71093449BLUEProduct31093449500
Sheet2
Cell Formulas
RangeFormula
G2:I7G2=LET(Prods,$A$2:$C$4,SKUS,$B$2:$B$4,sku,1*LEFT($F2,7),FILTER(Prods,SKUS=sku,"not found"))
Dynamic array formulas.
Thanks for your feedback. I would just need the price returning. It would be useful to not have to create a new worksheet to combine the data, or always have the others open. How would you suggesting using the power query?
 
Upvote 0
There many youtube channels that have lessons on it. ExcelIsFun, Mr. Excel, MyOnlineTrainingHub, and Leila Gharani are the ones I like best.
But, if you are completely new to it (It is not hard to get the basics down), look at this playlist from ExcelIsFun:


There is a lot, so, you'll have to look for the tutorials regarding lookups.

The Power Pivot playlist could help you too:

 
Upvote 0
There many youtube channels that have lessons on it. ExcelIsFun, Mr. Excel, MyOnlineTrainingHub, and Leila Gharani are the ones I like best.
But, if you completely new to it (It is not hard to get the basics down), look at this playlist from ExcelIsFun:


There is a lot, so, you'll have to look for the tutorials regarding lookups.

The Power Pivot playlist could help you too:

Thanks for pointing me in the right direction!
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,179
Members
452,615
Latest member
bogeys2birdies

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