简体   繁体   中英

Excel Lookup list partial match

I have 2 sheets.

Sheet 1 is the work sheet:

SONY KDL55W805CBAEP LED TV (Flat, 55 Zoll, FullHD, 3D, SMART TV, Android TV)
SONY KDL75W855CBAEP LED TV (Flat, 75 Zoll, FullHD, 3D, SMART TV, Android TV)
SONY KDL48W705CBAEP LED TV (Flat, 48 Zoll, FullHD, SMART TV)
SONY KD43X8305CBAEP LED TV (Flat, 43 Zoll, UHD 4K, SMART TV, Android TV)
SONY KDL50W756C LED TV (Flat, 50 Zoll, FullHD, SMART TV, Android TV)

Sheet 2 contains the full model reference numbers:

KDL55W805CBAEP
KDL75W855CBAEP
KDL48W705CBAEP
KD43X8305CBAEP
KDL50W756CBAEP

I'm using =IFERROR(LOOKUP(2^15;SEARCH(Sheet2!$B$1:$B$114;Sheet1![Row #]),Sheet2!$B$1:$B$114);"")

Everything gets match as long as the text in Sheet 1 is a 100% match. But as soon as it isn't I don't get a match.

For example.

Sheet 1:

SONY KDL50W756C LED TV (Flat, 50 Zoll, FullHD, SMART TV, Android TV)

Sheet2:

KDL50W756CBAEP

How can I make those match aswell?

EDIT:

This is sheet 1:

工作表1

This is sheet 2:

So in column item_model I want the full model reference. But as not all references in Sheet 1 match 100% with Sheet 2 I have a problem

工作表2

Use this formula if the Model number is always the second "Word":

=IFERROR(INDEX(Sheet2!B:B,MATCH(TRIM(MID("*" & SUBSTITUTE(B2," ",REPT(" ",99)),99,99)) & "*",Sheet2!B:B,0)),"")

在此处输入图片说明


EDIT: In Dutch, I think

=ALS.FOUT(INDEX(Sheet2!B:B;VERGELIJKEN(SPATIES.WISSEN(MIDDEN("*" & SUBSTITUEREN(B2;" ";HERHALING(" ";99));99;99)) & "*";Sheet2!B:B;0));"")

I may have some typos or missing )

=IFERROR(INDEX($B$1:$B$6,IF(AGGREGATE(14,6,(ISNUMBER(SEARCH(C1,$A$1:$A$6))*ROW(A1:A6)),1),AGGREGATE(14,6,(ISNUMBER(SEARCH(C1,$A$1:$A$6))*ROW(A1:A6)),1),-1)),"not found")

You will have to update the ranges to suit your needs.

C1 what you are looking for.
First A1:A5 what you are looking in.
B1:B6 what you want to return.
Row(A1:A5) is acting as a counter and may need adjusting if your data is not in the first row.

Tossed in some error generation and checking in case the item you were looking for is not in the list.

概念证明

This will work as long as what you are searching for is not so short as to be found partially after the start in the string. if you loosk at my example if you searked for K it would toss in the result from row 6 because K is found within the text in A6

In light of the edits

=IFERROR(INDEX($B$1:$B$6,IF(AGGREGATE(14,6,(ISNUMBER(SEARCH(MID(C1,FIND(" ",C1)+1,FIND(" ",C1,FIND(" ",C1)+1)-FIND(" ",C1)-1),$A$1:$A$6))*ROW(A1:A6)),1),AGGREGATE(14,6,(ISNUMBER(SEARCH(MID(C1,FIND(" ",C1)+1,FIND(" ",C1,FIND(" ",C1)+1)-FIND(" ",C1)-1),$A$1:$A$6))*ROW(A1:A6)),1),-1)),"not found")

This assumes what you are searching for is always between the first and second space in the item name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM