VLOOKUP Partial Word Match

Nanaia

Active Member
Joined
Jan 11, 2018
Messages
304
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Greetings!
I am trying to use VLOOKUP to find paint codes using a partial match to the paint color. The painter doesn't list the number preceding the color, only the word name (Chromium Gray instead of 971 Chromium Gray). I've tried using VLOOKUP to automatically populate the code from the paint library (named Table 5) but keep getting an #N/A error. Most codes are numerical however the custom codes have a asterisk at the beginning (like *126). The formula I've tried is
Excel Formula:
=VLOOKUP("* "&D2,ISNUMBER(Table5[[Product Name]:[Code]]),2,0)
. Can anyone help me get this to work?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi,

Is this what you mean, change range to your table name:

Book3.xlsx
DEFGH
1
2Chromium Gray971 Chromium Gray123 Red
3Orange*159 Orange456 Yellow
4789 Blue
5971 Chromium Gray
6*159 Orange
Sheet964
Cell Formulas
RangeFormula
E2:E3E2=LOOKUP(2,1/SEARCH(D2,H$2:H$6),H$2:H$6)
 
Upvote 0
Or may be you mean the 2nd sample below?

Book3.xlsx
DEFGHI
1
2Chromium Gray971 Chromium Gray123 Red
3Orange*159 Orange456 Yellow
4789 Blue
5971 Chromium Gray
6*159 Orange
7
8
9
10Chromium Gray67890123 Red23456
11Orange78901456 Yellow34567
12789 Blue56789
13971 Chromium Gray67890
14*159 Orange78901
Sheet964
Cell Formulas
RangeFormula
E2:E3E2=LOOKUP(2,1/SEARCH(D2,H$2:H$6),H$2:H$6)
E10:E11E10=LOOKUP(2,1/SEARCH(D10,H$10:H$14),I$10:I$14)
 
Upvote 0
Or may be you mean the 2nd sample below?

Book3.xlsx
DEFGHI
1
2Chromium Gray971 Chromium Gray123 Red
3Orange*159 Orange456 Yellow
4789 Blue
5971 Chromium Gray
6*159 Orange
7
8
9
10Chromium Gray67890123 Red23456
11Orange78901456 Yellow34567
12789 Blue56789
13971 Chromium Gray67890
14*159 Orange78901
Sheet964
Cell Formulas
RangeFormula
E2:E3E2=LOOKUP(2,1/SEARCH(D2,H$2:H$6),H$2:H$6)
E10:E11E10=LOOKUP(2,1/SEARCH(D10,H$10:H$14),I$10:I$14)
@jtakw Thank you. Your second example is closer to what I'm trying to accomplish. The only difference (although I don't know how crucial) would be that the asterisk is in front of the code number not the paint color. I am still getting an #N/A error using the formula from your cell E10
Excel Formula:
=LOOKUP(2,1/SEARCH(D2,Table5[Product Name]),Table5[Code])
 
Upvote 0
Makes no difference where the asterisk is, as long as the paint name matches:

Book3.xlsx
DEFGHI
10Chromium Gray*67890123 Red23456
11Orange*78901456 Yellow34567
12Pink#N/A789 Blue56789
13*971 Chromium Gray*67890
14159 Orange*78901
Sheet964
Cell Formulas
RangeFormula
E10:E12E10=LOOKUP(2,1/SEARCH(D10,H$10:H$14),I$10:I$14)


If you are still getting errors, it's time to post some samples, preferably using XL2BB, link in my signature.

EDIT: The only reason I can see for getting #N/A, is it's Not on the list, like Pink above.
 
Last edited:
Upvote 0
This is a work computer so I'm not comfortable downloading the XL2BB add-on.

The formula is on the DATA tab. The LIBRARY tab has the color and code library in Table5. The heading for the colors in the library is [Product Name] and the code is
Code:
 in the formula I shared.
Figure 1: Table5 (Paint Library)
[ATTACH type="full"]56291[/ATTACH]

Figure 2: DATA Tab (the only cell that has a formula is it is C2, all other data in column C is manually entered)
[ATTACH type="full"]56292[/ATTACH]

Figure 3: Listing of Chromium Gray in library
1643310477798.png
 

Attachments

  • 1643309853707.png
    1643309853707.png
    26.6 KB · Views: 8
  • 1643309984485.png
    1643309984485.png
    24.2 KB · Views: 7
Last edited:
Upvote 0
I don't see "Chromium Gray" in your short list, perhaps use a paint name that IS on your list where the formula Errors out.
 
Upvote 0
Solution
Ok, I missed your "Figure 3" and only looked at the attached pics in you post # 6,

How about this, instead of using your Named ranges, use regular cell referencing in the formula to see if it Still errors out, worth a shot.
 
Upvote 0
Your suggestion got me to look at the entry - it had an unneeded space at the end of it. I removed the space and it worked. Thank you!
 
Upvote 0
Your suggestion got me to look at the entry - it had an unneeded space at the end of it. I removed the space and it worked. Thank you!

You're welcome, thanks for letting me know.

Ah, that would be the same as if it wasn't on the list, thus #N/A.
I'm glad you sorted it out, and it's working for you now.
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,666
Members
448,977
Latest member
moonlight6

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