# Vlookup based on formatting

#### Alvin187

##### New Member
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

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

#### Joe4

##### MrExcel MVP, Junior Admin
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?

Replies
3
Views
374
Replies
2
Views
497
Replies
1
Views
86
Replies
0
Views
314
Replies
3
Views
60

1,147,734
Messages
5,742,862
Members
423,760
Latest member
photogfrog

### 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?

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