Forum Discussion
vlookup #N/A issues - not a 'newbie'
- Mar 08, 2022
Dominic_Joslin The A500 in my formula was just an example. Find the actual cell reference of the value that should match what is in cell D6 (the lookup_value in the VLOOKUP function). Let's say that actual reference is A235, then somewhere else type =D6=A235. If the result is FALSE, you know for sure that the two values are NOT the same.
By the way, I saw you post on Myonlinetraininghub where you asked the same question and where you received more or less the same answer.
Dominic_Joslin VLOOKUP returning an #N/A error means that it did NOT find a match. Are you sure that the numbers 333 are the same in both lists? What do you get when you enter a formula like
=D6='[Clients.xlsb]Jobs-Orders'!$A$500
where A500 in the Clients file also contains the 333 you are trying to match. Change that reference to the one that really contains 333. Do your get TRUE or FALSE?
If FALSE, then both "numbers" are not the same. One might have been entered(imported) as text. Reformatting the cell/column to Number or General will not automatically transform a text from, for instance " 333 " (note the leading/trailing spaces) to a number 333.
Riny_van_Eekelen Thank you for replying.
I have just checked the 333 numbers, and in both places lookup_value, and table_array, they seem to be 'clean', IE no empty spaces before or after, and both formatted as numbers.
I tried to paste your suggested test formula, and twice, IE in two different cells it returns False. I tried it with both A500 and A333.
Curiously, when I try my formula in a cell on another Sheet in the Workbook, it works fine. ?? Could there be something up with the new sheet?
- Riny_van_EekelenMar 08, 2022Platinum Contributor
Dominic_Joslin The A500 in my formula was just an example. Find the actual cell reference of the value that should match what is in cell D6 (the lookup_value in the VLOOKUP function). Let's say that actual reference is A235, then somewhere else type =D6=A235. If the result is FALSE, you know for sure that the two values are NOT the same.
By the way, I saw you post on Myonlinetraininghub where you asked the same question and where you received more or less the same answer.
- Dominic_JoslinMar 08, 2022Copper ContributorHi Riny. I just tried what you suggested, and the result was True. What I was doing before was entering the value of col/row A235 (for eg.), being 333 (IE: A333), rather than the proper cell reference. So your test indicates that the values are the same.
However, good news: the problem formula is now working correctly. I don't know exactly what action has fixed it, but I'm going to credit it to your input. So, thank you.- JoeUser2004Mar 23, 2022Bronze Contributor
Dominic_Joslin wrote: ``I don't know exactly what action has fixed it``
The original problem was probably because the value in D6 and/or A235 is calculated, and one or both are infinitesimally different from 333.
They might appear to be 333 because Excel formats only up to 15 significant digits.
Copy-and-pasting the displayed value corrected the problem because that eliminates any invisible infinitesimal difference.
VLOOKUP(...,FALSE) requires exact binary equality.
=D6=A235 is not sufficient to test for exact binary equality because the "=" operator rounds the operands to 15 significant digits internally just for the purpose of comparison.
One correct way to test for binary equality is =D6-A235=0.
(Yes, mathematically they should be same. Sigh.)
You can see the infinitesimal differences, if any, with the following formulas, formatted as Scientific:
=SUM(D6,-(D6&""))
=SUM(A235,-(A235&""))
0.00E+00 is exactly zero, which indicates no infinitesimal difference between the binary representation of the displayed value (D6&"") and the actual value (D6).
FYI, we must use SUM instead of =D6-(D6&"") because for formulas of that form, sometimes Excel replaces the infinitesimal difference with exactly zero arbitrarily because it decides that the two operands are "close enough".
As an example, enter 333 into A1, and enter =333+2^-44 into A2.
Note that A2 displays 333, even when formatted to display 12 or more decimal places (15 significant digits).
=VLOOKUP(A1,A2,1,FALSE) returns #N/A, which is correct.
=A1=A2 returns TRUE, and =A1-A2 displays 0.00E+00 when formatted as Scientific.
But =A1-A2=0 returns FALSE, which is correct.
=SUM(A1,-(A1&"")) displays 0.00E+00, but =SUM(A2,-(A2&"")) displays 5.68E-14 when formatted as Scientific.
Hope that helps if and when your encounter this problem in the future. It is more common than people think.