Vlookup returns #NA, when table array is valid

questforexcel

Board Regular
Joined
Jan 18, 2019
Messages
128
Office Version
  1. 2013
Platform
  1. Windows
Hi All,

So my vlookup formula is referencing from a table where data exists and I am pulling it from the right column.

There are no spaces , or additional characters in any cell.

What I understand is the issue is that the lookup range and table array may still be in different formats. I read somewhere, that using text to columns to convert both the formats to general should help. I even did that, that did not work.

This is my formula.

=VLOOKUP(LEFT(A5,5),'Fedex Chart'!$B$4:$E$91252,4,0)

The table array looks like this

Dest Zip/Postal CodePost Code Service Days Zone
500.0050036
501.0050136
502.0050236
503.0050336
504.0050436
505.0050536

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>

My lookup range are

Postal Code
2176
2635
2816
8505
8826
10598

<colgroup><col></colgroup><tbody>
</tbody>

I searched online for solutions to this problem, could not find an answer. Could you please help in.

Regards
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
LEFT produces text whether the result is a number or not so maybe:

=VLOOKUP(0+LEFT(A5,5),'Fedex Chart'!$B$4:$E$91252,4,0)
 
Upvote 0
Even if both the values you are matching on are General (Numbers) and not Text, the LEFT function you are using returns a String result. So comparing a String to a Number would not work.
Try changing:
Code:
[COLOR=#333333]LEFT(A5,5)
to
[/COLOR]
Code:
[COLOR=#333333]LEFT(A5,5)+0[/COLOR]
to coerce it to be a number.
 
Upvote 0
are you trying to pull data from


Book1
ABCD
1Dest Zip/Postal CodePost CodeService DaysZone
250050036
350150136
450250236
550350336
650450436
750550536
Sheet5

to

Book1
FG
1Postal Code
22176?
32635?
42816?
58505?
68826?
710598?
Sheet5


if so, what results are you expecting?
 
Upvote 0
Thank you so much for the quick response, this did work :)

Just a clarification, if you could help, I had another sheet of data with similar referencing points.

Over there, the "LEFT" function formula worked fine. I didn't have to "+0" and it worked. Is there something, I'd be missing there or would have added there.


This is how the formula appeared

=IFERROR(VLOOKUP(LEFT(A5,3),'USPS Chart'!$B$5:$C$123,2,1),"")

This was the lookup array

Postal Code
2575
7632
9314
9354
10010

<colgroup><col></colgroup><tbody>
</tbody>

These were the array table where it was pulling the information from

ZIP CodeZone
005-0766
775
078-0796
080-0875
088-0896
090-0986+
100-1496
150-1665
1676
168-2125

<colgroup><col><col></colgroup><tbody>
</tbody>


Thank you so much for the quick help.


Even if both the values you are matching on are General (Numbers) and not Text, the LEFT function you are using returns a String result. So comparing a String to a Number would not work.
Try changing:
Code:
[COLOR=#333333]LEFT(A5,5)[/COLOR]

to
Code:
[COLOR=#333333]LEFT(A5,5)+0[/COLOR]
to coerce it to be a number.
 
Upvote 0
Hi,

Thats correct this is from where I am trying to pull my data.

2176 doesn't appear below as I'd only included the 1st few data points, the list goes on for 91K lines.

For 2176 i'd like it to return the corresponding zone value which is 6.

Also how did you insert these tables with row and column nos. :) Its so much easier for readers reference. Couldn't find this while typing out my queries.


are you trying to pull data from

ABCD
1Dest Zip/Postal CodePost CodeService DaysZone
250050036
350150136
450250236
550350336
650450436
750550536

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet5


to
FG
1Postal Code
22176?
32635?
42816?
58505?
68826?
710598?

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet5



if so, what results are you expecting?
 
Upvote 0
Over there, the "LEFT" function formula worked fine. I didn't have to "+0" and it worked. Is there something, I'd be missing there or would have added there.
If the LEFT function worked over there, it means that the data column that you are matching on must be formatted as Text, not Numeric/General.

Basically, the value you are looking up and the value you are matching on MUST be the same data type (number-to-number or text-to-text).
Beware of "numbers" entered as "text". Switching the format to "General" will not change that. Formatting only affects how numbers are displayed. They do not change Data Types. You would need to use a method like Text to Columns to change that (or some formula).
 
Upvote 0
In your first example you used:

=VLOOKUP(LEFT(A5,5),'Fedex Chart'!$B$4:$E$91252,4,0)

Then you used:

=IFERROR(VLOOKUP(LEFT(A5,3),'USPS Chart'!$B$5:$C$123,2,1),"")

There is a big difference between using ,0 and ,1 for the last parameter of a VLOOKUP. I suspect your 2nd example was producing results that arent exactly what you expect.
 
Upvote 0
Thats correct, I had used 1 cause I wanted an approximation for my results.

My table array was in ranges, so I used 0, it did not return the values for my data.

When I used, 1, it did give in the approximate values to it.

Is this wrong? Is there a better way to reference data which falls in ranges.

Thank you

In your first example you used:

=VLOOKUP(LEFT(A5,5),'Fedex Chart'!$B$4:$E$91252,4,0)

Then you used:

=IFERROR(VLOOKUP(LEFT(A5,3),'USPS Chart'!$B$5:$C$123,2,1),"")

There is a big difference between using ,0 and ,1 for the last parameter of a VLOOKUP. I suspect your 2nd example was producing results that arent exactly what you expect.
 
Upvote 0

Forum statistics

Threads
1,214,782
Messages
6,121,532
Members
449,037
Latest member
tmmotairi

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