Vlookup Returning #N/A Error

britsgal

Board Regular
Joined
Apr 8, 2014
Messages
75
Office Version
  1. 365
Platform
  1. Windows
I'm performing a vlookup using a number where I have created a unique identifier for the number since there are several occurrences of data that I need to pull back. For example:

Starting Number: 530
Adding to starting number: .001
Ending with: 530.001 etc.

The vlookup works fine from 530, 530.001, 530.002 but then at 530.003 the formula returns an #N/A error. We've looked at the formula and have confirmed that the values that are being looked up to are idential to the values being looked up from and that all values appear in the vlookup list. I'm perplexed as I've never seen this happen before. Any ideas?

Thanks for the help!
Laura
 

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.
The vlookup is as follows: =vlookup($a5,$C$5:$D$17,2,0). The vlookup source data is being pulled back from a different tab within the workbook. Here is an example of the data with column and row labels:


A
B
C
D
value
vlookup
source data
5
530.002
409
188
930
6
530.003
#N/A
530
220
7
534
140
530.001
400
8
534.002
273
530.002
409
9
534.003
#N/A
530.003
4092
10
530.004
4900
11
530.005
4901
12
530.006
4902
13
532
220
14
534
140
15
534.001
272
16
534.002
273
17
534.003
277

<tbody>
</tbody>
 
Upvote 0
The vlookup is as follows: =vlookup($a5,$C$5:$D$17,2,0). The vlookup source data is being pulled back from a different tab within the workbook. Here is an example of the data with column and row labels:


ABCD
valuevlookupsource data
5530.002409188930
6530.003#N/A530220
7534140530.001400
8534.002273530.002409
9534.003#N/A530.0034092
10530.0044900
11530.0054901
12530.0064902
13532220
14534140
15534.001272
16534.002273
17534.003277

<tbody>
</tbody>
 
Upvote 0
Starting Number: 530
Adding to starting number: .001
Ending with: 530.001 etc.

The vlookup works fine from 530, 530.001, 530.002 but then at 530.003 the formula returns an #N/A error.

When you add 0.001, do it this way (in C7, for example):

=ROUND(C6+0.001,3)

When you do simply C6+0.001, you are encountering infinitesimal arithmetic anomalies that commonly arise because Excel uses binary to represent numbers and perform arithmetic. Consequently, most non-integers cannot be represented exactly.

Using ROUND(...,3) ensures that the binary representation of the rounded expression is the same as the binary representation of the equivalent constant, 530.003 in this case.

[EDIT] Example:


Internal Representation: Prev+0.001Internal Representation: Constant
530.002530.001999999999,95270627550780773162841796875530.001999999999,95270627550780773162841796875
530.003530.002999999999,929059413261711597442626953125530.003000000000,0427462509833276271820068359375



534.002534.001999999999,95270627550780773162841796875534.001999999999,95270627550780773162841796875
534.003534.002999999999,929059413261711597442626953125534.003000000000,0427462509833276271820068359375

<tbody>
</tbody>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,525
Messages
6,120,051
Members
448,940
Latest member
mdusw

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