Vlookup based on formatting

Alvin187

New Member
Joined
Jul 8, 2021
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
My lookup table has values that have special formatting, example

CodeVariant name
000No sub Variant
the code that am using is this
Excel Formula:
 VLOOKUP((MID(A2,13,3),'[New Variant Name.xlsx]Legend for New Variant Number'!$K$5:$L$49,2,FALSE)

Output of
Excel Formula:
 MID(A2,13,3) is 000
but the vlookup always gives
Excel Formula:
#N/A
,

In the table if you
Excel Formula:
check the value of code (000) in formula bar, u get 0. and the corresponding cell in the lookup table is 0
that is why vlookup is failing, so what can be done here? any suggestions?

I have checked the obvious and that didnt work either,
Excel Formula:
VLOOKUP(if((MID(A2,13,3)= 0,Text(0,000),MID(A2,13,3)),'[New Variant Name.xlsx]Legend for New Variant Number'!$K$5:$L$49,2,FALSE)

Excel Formula:
Value of cell A2 is UPE00819-YCU000-NA
Excel Formula:
Value of cell K6 (where 000 is present) is 0


Any ideas on how to progress? Thanks in advance
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
It is important to understand that Excel formulas work off of the actual values in the cell, not the formatted/displayed value.
It sounds like the value in cell K6 is really the numeric value of 0, with special formatting to display three digits.

So we need our formula to return a numeric value, not a text one, like the MID function will return.
However, we can easily coerce the formula to return a numeric value by applying a simple calculation to it, like this:
Rich (BB code):
=VLOOKUP((MID(A2,13,3)+0,'[New Variant Name.xlsx]Legend for New Variant Number'!$K$5:$L$49,2,FALSE)

Does that work?
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,433
Members
448,897
Latest member
ksjohnson1970

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