Trouble with VLOOKUP Matching text string anywhere in field

aafowler

New Member
Joined
Dec 13, 2017
Messages
1
I am trying to use VLOOKUP to match the text in Field C with the text in Field A and then populate Field D with the values from Field B. The formula I am using is =VLOOKUP("*"&C2&"*",$A$2:$B$7,2,FALSE). The first table below is the results I would like. The second table shows the results that I am getting. Any advice would be great. Thanks.

Field A
Field B
Field C
Field D
Paper Gasket
1
Yellow Paper Gasket
1
Spacer
2
round spacer
2
Paper Liner
3
Paper Liner Small
3
Spark Plug
4
small pipe
6
Spring
5
liner
3
Pipe
6
Spring 2.5
5

<tbody>
</tbody>

Field A
Field B
Field C
Field D
Paper Gasket
1
Yellow Paper Gasket
#N/A
Spacer
2
round spacer
#N/A
Paper Liner
3
Paper Liner Small
#N/A
Spark Plug
4
small pipe
#N/A
Spring
5
liner
1
Pipe
6
Spring 2.5
2

<tbody>
</tbody>
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
There may be a better way of doing this, but this appears to work;

Try this in cell: D2 then copy it on down...

=IFERROR(VLOOKUP("*"&C2&"*",$A$2:$B$7,2,FALSE),LARGE(ISNUMBER(SEARCH(("*"&INDEX($A$2:$A$7,)&"*"),$C2))*$B$2:$B$7,1))

It is an array formula, so you need to enter it with: Ctrl + Sht. + Enter
 
Last edited:
Upvote 0
Or…….

=IFERROR(LOOKUP(9^9,SEARCH(C2,A$2:A$7),B$2:B$7),LOOKUP(9^9,SEARCH(A$2:C$7,C2),B$2:B$7))

Regards
Bosco
 
Upvote 0
In D2 enter and copy down:

=IFERROR(LOOKUP(9.99999999999999E+307,SEARCH(" "&$A$2:$A$7&" "," "&C2&" "),$B$2:$B$7),VLOOKUP("*"&C2&"*",$A$2:$B$7,2,0))
 
Upvote 0

Forum statistics

Threads
1,215,362
Messages
6,124,502
Members
449,166
Latest member
hokjock

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