SOLVED

Mysterious bug on excel calculation, on a vlookup

%3CLINGO-SUB%20id%3D%22lingo-sub-2413626%22%20slang%3D%22en-US%22%3EMysterious%20bug%20on%20excel%20calculation%2C%20on%20a%20vlookup%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2413626%22%20slang%3D%22en-US%22%3E%3CP%3EAs%20you%20can%20see%20on%20the%20excel%20file%2C%20the%20value%20on%20A7%20and%20A8%20looks%20like%20a%20100%25%20like%20the%20one%20on%20A11%20and%20A12.%20But%20when%20using%20the%20VLookup%20with%20it%2C%20it%20gets%20to%20different%20results!%3C%2FP%3E%3CP%3EThis%20makes%20many%20errors%20on%20calculations%20on%20our%20company%2C%20recently%20detected.%3C%2FP%3E%3CP%3EWould%20be%20nice%20to%20know%20what%20happend%20and%20how%20to%20fix%20it!%2C%20maybe%20it's%20something%20with%20hidden%20decimals%20floating%20point%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2413626%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2413745%22%20slang%3D%22en-US%22%3ERe%3A%20Mysterious%20bug%20on%20excel%20calculation%2C%20on%20a%20vlookup%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2413745%22%20slang%3D%22en-US%22%3EI%20don't%20have%20a%20good%20satisfying%20answer.%20They%20look%20the%20same%20and%20everything%20I%20do%20seems%20to%20indicate%20they%20are%20the%20same%20BUT%20A7%20and%20A8%20are%20text%20or%20something.%20If%20you%20re-type%20the%20value%20in%20it%20works%20fine%2C%20if%20you%20change%20the%20formula%20to%3CBR%20%2F%3E%3DVLOOKUP(VALUENUMBER(A7)%2C%24A%242%3A%24B%244%2C2%2CTRUE)%3CBR%20%2F%3Eor%3CBR%20%2F%3E%3DVLOOKUP(--A7%2C%24A%242%3A%24B%244%2C2%2CTRUE)%3CBR%20%2F%3Ethey%20work.%3CBR%20%2F%3EIs%20it%20possible%20you%20used%20a%20keyboard%20or%20computer%20set%20to%20a%20different%20language%20or%20extended%20keyset%20where%20the%20characters%20are%20actually%20in%20the%20extended%20range%3F%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2414030%22%20slang%3D%22en-US%22%3ERe%3A%20Mysterious%20bug%20on%20excel%20calculation%2C%20on%20a%20vlookup%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2414030%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1070571%22%20target%3D%22_blank%22%3E%40Glarrain%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20real%20values%20in%20A7%20and%20A8%20are%26nbsp%3B0.99999999999999989%20and%26nbsp%3B0.99999999999999989.%3C%2FP%3E%3CP%3EThe%20values%20were%20probably%20copied%20from%20another%20source.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2414032%22%20slang%3D%22en-US%22%3ERe%3A%20Mysterious%20bug%20on%20excel%20calculation%2C%20on%20a%20vlookup%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2414032%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1070571%22%20target%3D%22_blank%22%3E%40Glarrain%3C%2FA%3E%26nbsp%3B%20wrote%3A%20%60%60A7%20and%20A8%20looks%20like%20a%20100%25%20like%20the%20one%20on%20A11%20and%20A12%60%60%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20looks%20can%20be%20deceiving.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20problem%20has%20nothing%20to%20do%20with%20errant%20characters%20(which%20would%20result%20in%20%23VALUE%20errors%2C%20anyway)%2C%20and%20using%20the%20Excel%20VALUE%20or%20VLOOKUP(...%2CTRUE)%20might%20work-around%20the%20problem%20only%20by%20coincidence.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EInstead%2C%20this%20is%20just%20yet-another%20example%20of%20binary%20(floating-point)%20arithmetic%20anomalies.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23FF0000%22%3EThe%20work-around%20is%3A%26nbsp%3B%20whenever%20you%20expect%20a%20calculation%20to%20be%20accurate%20to%20some%20number%20of%20decimal%20places%2C%20explicitly%20round%20to%20that%20number%20of%20decimal%20places%20--%20and%20not%20to%20arbitrary%20number%2C%20as%20some%20people%20suggest.%3C%2FFONT%3E%26nbsp%3B%20For%20whole%20percentage%20values%2C%20round%20to%202%20decimal%20places%20(because%2012%25%20is%200.12).%26nbsp%3B%20For%20percentage%20values%20that%20should%20be%20accurate%20to%202%20percentage%20decimal%20places%2C%20round%20to%204%20decimal%20places%20(because%2012.34%25%20is%200.1234).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20appears%20that%20the%20values%20in%20A7%20and%20A8%20had%20been%20calculated%20(somewhere)%2C%20then%20copy-and-pasted-value%20into%20A7%20and%20A8.%26nbsp%3B%20And%20the%20calculated%20values%20are%20infinitesimally%20smaller%20(-1.11E-16)%20than%20how%20the%20values%20appear%2C%20even%20when%20formatted%20to%20display%2015%20significant%20digits.%26nbsp%3B%20We%20can%20see%20such%20differences%20with%20formulas%20of%20the%20form%20%3DSUM(A7%2C-(A7%26amp%3B%22%22))%20formatted%20as%20Scientific%20or%20General.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(That%20works%20because%20the%20expression%20A7%26amp%3B%22%22%20returns%20the%20value%20formatted%20with%20up%20to%2015%20significant%20digits.%26nbsp%3B%26nbsp%3B%20That%20is%20Excel's%20arbitrary%20%3CU%3E%3CEM%3Eformatting%3C%2FEM%3E%3C%2FU%3E%20limit.%26nbsp%3B%20It%20is%20%3CEM%3E%3CU%3Enot%3C%2FU%3E%3C%2FEM%3E%20the%20limit%20of%20numeric%20precision%2C%20as%20many%20documents%20state%20incorrectly.)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAdditionally%2C%20VLOOKUP%20is%20among%20the%20many%20Excel%20functions%20that%20compare%20exact%20binary%20values%2C%20not%20the%20values%20arbitrarily%20rounded%20to%20up%20to%2015%20significant%20digits%2C%20as%20compare%20operators%20(%22%3D%22%2C%20%22%26gt%3B%3D%22%2C%20etc)%20and%20the%20*IF%5BS%5D%20functions%20do%20(COUNTIF%2C%20SUMIFS%2C%20etc).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESince%20the%20value%20in%20A7%20is%20infinitesimally%20less%20than%20the%20value%20in%20A4%20(exactly%20100%25)%2C%20VLOOKUP(...%2CTRUE)%20returns%20the%20value%20in%20column%20B%20(B3)%20that%20corresponds%20to%20the%20largest%20value%20less%20than%20100%25%2C%20namely%2095%25%20in%20A3.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESince%20the%20(same)%20value%20in%20A8%20is%20infinitesimally%20different%20from%20the%20value%20in%20A4%2C%20VLOOKUP(...%2CFALSE)%20returns%20%23N%2FA%20because%20it%20fails%20to%20find%20an%20exactly%20binary%20match.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20both%20case%2C%20one%20work-around%20is%20to%20use%20ROUND(A7%2C4)%20and%20ROUND(A8%2C4)%2C%20if%20you%20want%20to%20allow%20for%20accuracy%20to%20fractional%20percentages%20(2%20percentage%20decimal%20places)%2C%20as%20you%20format%20them.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnother%20solution%20is%20to%20explicitly%20round%20the%20calculations%20the%20sourced%20the%20values%20in%20A7%20and%20A8.%26nbsp%3B%20You%20do%20not%20show%20us%20those%20formulas.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENeither%20solution%20is%20more%20%22right%22%20or%20%22wrong%22.%26nbsp%3B%20The%20choice%20is%20yours%20to%20make%2C%20depending%20on%20your%20intentions.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2414038%22%20slang%3D%22en-US%22%3ERe%3A%20Mysterious%20bug%20on%20excel%20calculation%2C%20on%20a%20vlookup%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2414038%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1639%22%20target%3D%22_blank%22%3E%40Detlef%20Lewin%3C%2FA%3E%26nbsp%3B%20wrote%3A%20%60%60A7%20and%20A8%20are%200.99999999999999989%20and%200.99999999999999989%60%60.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENot%20really.%26nbsp%3B%20That%20is%20just%20a%2017-digit%20approximation%2C%20which%20is%20sufficient%20to%20reproduce%20the%20binary%20value%20exactly.%26nbsp%3B%20We%20can%20see%20those%20values%20in%20the%20XML%20file%20that%20%22xslx%22%20files%20are%20stored%20as%2C%20as%20you%20know.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20the%20exact%20decimal%20representation%20of%20the%20binary%20values%20is%200.999999999999999%2C88897769753748434595763683319091796875.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(I%20use%20period%20for%20the%20decimal%20place%20and%20comma%20to%20demarcate%20the%20first%2015%20significant%20digits.)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2414049%22%20slang%3D%22en-US%22%3ERe%3A%20Mysterious%20bug%20on%20excel%20calculation%2C%20on%20a%20vlookup%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2414049%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F146717%22%20target%3D%22_blank%22%3E%40Joe%20User%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CBLOCKQUOTE%3E%3CHR%20%2F%3EBut%20the%20exact%20decimal%20representation%20of%20the%20binary%20values%20is%200.999999999999999%2C88897769753748434595763683319091796875.%3CP%3E%26nbsp%3B%3C%2FP%3E%3CHR%20%2F%3E%3C%2FBLOCKQUOTE%3E%3CP%3EWhere%20did%20you%20get%20this%20value%20from%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2414066%22%20slang%3D%22en-US%22%3ERe%3A%20Mysterious%20bug%20on%20excel%20calculation%2C%20on%20a%20vlookup%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2414066%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1639%22%20target%3D%22_blank%22%3E%40Detlef%20Lewin%3C%2FA%3E%26nbsp%3B%26nbsp%3Band%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F146717%22%20target%3D%22_blank%22%3E%40Joe%20User%3C%2FA%3E%26nbsp%3B%2C%20you%20both%20indicate%20that%20the%20value%20is%20a%20round%20off%20error.%20how%20did%20you%20determine%20that%3F%20I%20expanded%20the%20number%20of%20decimal%20places%20and%20did%20not%20see%20that%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22mtarler_0-1622749088046.png%22%20style%3D%22width%3A%20338px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F286104i16F644B845D6E290%2Fimage-dimensions%2F338x190%3Fv%3Dv2%22%20width%3D%22338%22%20height%3D%22190%22%20role%3D%22button%22%20title%3D%22mtarler_0-1622749088046.png%22%20alt%3D%22mtarler_0-1622749088046.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3Eis%20there%20some%20other%20trick%20i%20should%20be%20using%20to%20check%20for%20that%3F%3C%2FP%3E%3CP%3EFurthermore%2C%20that%20doesn't%20explain%20why%20NUMBERVALUE()%20or%20--TRIM()%20applied%20to%20that%20cell%20would%20fix%20that%20issue%20since%20if%20it%20really%20is%200.999999...%20neither%20of%20those%20functions%20would%20change%20or%20fix%20that.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

As you can see on the excel file, the value on A7 and A8 looks like a 100% like the one on A11 and A12. But when using the VLookup with it, it gets to different results!

This makes many errors on calculations on our company, recently detected.

Would be nice to know what happend and how to fix it!, maybe it's something with hidden decimals floating point?

11 Replies

I don't have a good satisfying answer. They look the same and everything I do seems to indicate they are the same BUT A7 and A8 are text or something. If you re-type the value in it works fine, if you change the formula to
=VLOOKUP(NUMBERVALUE(A7),$A$2:$B$4,2,TRUE)
or
=VLOOKUP(--CLEAN(A7),$A$2:$B$4,2,TRUE)
they work.
Is it possible you used a keyboard or computer set to a different language or extended keyset where the characters are actually in the extended range?

I apologize for the EDIT notifications: but basically I noticed that I was wrong on the 2nd option above because I originally thought --A7 worked but it didn't and only worked if I also used the CLEAN() function which further points to my question above about another language keyboard or if you imported data.  CLEAN specifically removes non-printable characters in the low range of ASCII.  

@Glarrain 

The real values in A7 and A8 are 0.99999999999999989 and 0.99999999999999989.

The values were probably copied from another source.

 

best response confirmed by Glarrain (Occasional Visitor)
Solution

@Glarrain  wrote: ``A7 and A8 looks like a 100% like the one on A11 and A12``

 

And looks can be deceiving.

 

The problem has nothing to do with errant characters (which would result in #VALUE errors, anyway), and using the Excel VALUE or VLOOKUP(...,TRUE) function might work-around the problem only by coincidence.

 

Instead, this is just yet-another example of binary (floating-point) arithmetic anomalies.

 

The work-around is:  whenever you expect a calculation to be accurate to some number of decimal places, explicitly round to that number of decimal places -- and not to arbitrary number, as some people suggest.  For whole percentage values, round to 2 decimal places (because 12% is 0.12).  For percentage values that should be accurate to 2 percentage decimal places, round to 4 decimal places (because 12.34% is 0.1234).

 

It appears that the values in A7 and A8 had been calculated (somewhere), then copy-and-pasted-value into A7 and A8.  And the calculated values are infinitesimally smaller (-1.11E-16) than how the values appear, even when formatted to display 15 significant digits.  We can see such differences with formulas of the form =SUM(A7,-(A7&"")) formatted as Scientific or General.

 

(That works because the expression A7&"" returns the value formatted with up to 15 significant digits.   That is Excel's arbitrary formatting limit.  It is not the limit of numeric precision, as many documents state incorrectly.)

 

Additionally, VLOOKUP is among the many Excel functions that compare exact binary values, not the values arbitrarily rounded to up to 15 significant digits, as compare operators ("=", ">=", etc) and the *IF[S] functions do (COUNTIF, SUMIFS, etc).

 

Since the value in A7 is infinitesimally less than the value in A4 (exactly 100%), VLOOKUP(...,TRUE) returns the value in column B (B3) that corresponds to the largest value less than 100%, namely 95% in A3.

 

Since the (same) value in A8 is infinitesimally different from the value in A4, VLOOKUP(...,FALSE) returns #N/A because it fails to find an exactly binary match.

 

In both cases, one work-around is to use ROUND(A7,4) and ROUND(A8,4) if you want to allow for accuracy to fractional percentages (2 percentage decimal places), as you format them.

 

Another solution is to explicitly round the calculations that sourced the values in A7 and A8.  You do not show us those formulas.

 

Neither solution is more "right" or "wrong".  The choice is yours to make, depending on your intentions.

@Detlef Lewin  wrote: ``A7 and A8 are 0.99999999999999989 and 0.99999999999999989``.

 

Not really.  That is just a 17-digit approximation, which is sufficient to reproduce the binary value exactly.  We can see those values in the XML file that "xslx" files are stored as, as you know.

 

But the exact decimal representation of the binary values is 0.999999999999999,88897769753748434595763683319091796875.

 

(I use period for the decimal place and comma to demarcate the first 15 significant digits.)

@Joe User 


But the exact decimal representation of the binary values is 0.999999999999999,88897769753748434595763683319091796875.

 


Where did you get this value from?

 

@Detlef Lewin  and @Joe User , you both indicate that the value is a round off error. how did you determine that? I expanded the number of decimal places and did not see that:

mtarler_0-1622749088046.png

is there some other trick i should be using to check for that?

Furthermore, that doesn't explain why NUMBERVALUE() or --TRIM() applied to that cell would fix that issue since if it really is 0.999999... neither of those functions would change or fix that.

@Detlef Lewin  wrote, referring to 0.999999999999999,88897769753748434595763683319091796875: ``Where did you get this value from?``

 

64-bit binary floating-point values are the sum of 53 consecutive powers of 2, scaled by a power of 2.  I wrote VBA code to calculate the exact sum.  (I wrote the code 16+ years ago.)

 

Using a browser search, I believe you can find online "calculators" that do the same thing.  But beware:  some of them use the 32-bit BFP representation, which is a sum of only 24 consecutive powers of 2.

@mtarler  wrote: ``you both indicate that the value is a round off error. how did you determine that? I expanded the number of decimal places and did not see that``

 

As I explained:  ``We can see such differences with formulas of the form =SUM(A7,-(A7&"")) formatted as Scientific or General``.

 

FYI, we cannot always use simply =A7-(A7&"") because of other anomalies that are specific to Excel arithmetic.  In particular, sometimes Excel replaces the exact infinitesimal difference of a cell formula with exactly zero, if Excel (arbitrarily) deems that the two operands of the last subtraction are "close enough".

 

And as I explained, arguably not clearly:  Excel formats ``up to 15 significant digits.   That is Excel's arbitrary formatting limit.  It is not the limit of numeric precision, as many documents state incorrectly.``

 

That is why we cannot see the infinitesimal differences in some cases, as you demonstrated.

 

Finally, as I explained (7 min before your posting, so you might have missed it), we can see values formatted with up to __17__ significant digits by looking at the XML worksheet in the "xlsx" file, among other methods.

 

The "xlsx" and "xlsm" files are zip archives.  Copy foobar.xlsx to foobar.zip, then double click foobar.zip in Windows, find the XML worksheet, and open it in Notepad.  You will see entries like 0.99999999999999989 surrounded by "v" tags.

 

The 17-digit decimal value is just yet-another approximation of the binary value.  But the IEEE 754 standard specifies that 17 significant digits (rounded) is sufficient to convert between decimal and binary representations with no loss of precision.

 

(BTW, the IEEE 754 standard __never__ mentions anything about 15 significant digits, contrary to most online documents, from MSFT and others.)

(With critical corrections for posterity.)

 

@mtarler  wrote: ``that doesn't explain why NUMBERVALUE() or --TRIM() applied to that cell would fix that issue since if it really is 0.999999... neither of those functions would change or fix that``.

 

Sorry, I overlooked that question.

 

They work-around the problem because they cause Excel to return the value rounded to 15 significant digits.  In this case, 1 - 2^-53 (approx 0.99999999999999989) rounds to exactly 1, which is a binary match for the value in A4 (100%).

 

But as I said before, that is only by coincidence.

 

Consider the following example.

 

Enter =1 + 2^-52 into A4.  That might be the result of a calculation that we expected to be exactly 100%.

 

Then, with =1 - 2^-53 in A7, note that VLOOKUP(NUMBERVALUE(A7),A4,1,FALSE) and VLOOKUP(NUMBERVALUE(A7),A4,1,TRUE) still return #N/A (no match).

 

The reason is:  NUMBERVALUE(A7) rounds A7 to exactly 1 (100%), but it does not match the exact binary value in A4.

 

In contrast, if we enter exactly 1 into A4, both VLOOKUPs return 1 (match) because the binary values now match.

 

Thank you for your explanations. Yes I finally did go into the XML file and see the actual stored value as 0.9999....98. The round off error was my first thought but naively thought I would be able to see it if i expanded the precision enough. And yes you must be right that both NUBMERVALUE() and --TRIM() must be forcing the value to be read as text and then converted back to a number and result in 1.0 (100%) as the value. That said, VALUE() function does NOT work the same and does not appear to force that conversion/rounding. But I did test and see that even if I type =1.0-1.11E-16 into a cell and then force Excel to show 20+ digits it still displays as 1.00000000... or 100.000000....% but then using those formulas it presents the same problem. I even tried tricks like looking at the cell using =TEXT(1-(1E-20),"0.0000000000000000000000") or =TEXT(1-(1E-20),"0.00000000000000000000000E+00") and excel still refuses to cough up the actual full precision value. I wish there was a way to make excel cough that up without going into the XML...

@mtarler  wrote: ``you must be right [about] NUBMERVALUE() [... but] VALUE() function does NOT work the same and does not appear to force that conversion/rounding``

 

You are right.  I made a lot of typos in that posting:  substituting VALUE for NUMBERVALUE; substituting VLOOKUP for MATCH -- or better, using VLOOKUP correctly for comparison; using decimal approximations (1.11E-16) instead of the exact binary values that I intended (2^-53); and intending to use 1+2^-53 ("1+1.11E-16" sic) in A4 instead of 1+2^-52 (approx 1+2.22E-16).

 

I think you got the gist of it (``you must be right that both NUBMERVALUE() and --TRIM() must be forcing the value to be read as text``).  But I might correct my previous posting for posterity.

 

 

-----

 

@mtarler  wrote: ``I even tried tricks like [...] =TEXT(1-(1E-20),"0.00000000000000000000000E+00") and excel still refuses to cough up the actual full precision value``

 

What part of ``Excel formats up to 15 significant digits. That is Excel's arbitrary formatting limit`` did you not understand? (wink)

 

Oh well, with all of my previous typos noted above, perhaps I deserve a little distrust (sigh).

 

BTW, -1E-20 is too small to make a difference, anyway.  Note that MATCH(1-1E-20,{1},0) returns 1, indicating a binary match.

 

In contrast, MATCH(1-2^-53,{1},0) returns #N/A, indicating no binary match. IOW, -2^-53 makes the intended difference. (But +2^-53 does not.)