I have an Excel spreadsheet (generated by spreadsheet gear, but it's more an Excel problem) that isn't functioning as i would expect when I use HLOOKUPS. I use a simple HLOOKUP to look up the value at a given percent in a table. For two certain values, the HLOOKUP fails. These values are 0.9993 and 0.999. This excel document demonstrates the problem: http://dsokol.com/tokio/excelna.xlsx. Cells C6 and C7 are showing as N/A, when they are intended to be populated with B and C. If I re-key over the values, the HLOOKUPs start working again.
Can anyone explain why this is occurring?
The problem is those numbers are being stored as strings and not integers. I guess you need to explicitly declare the column type in SpreadSheet Gear.
If you open the xlsx file as a zip file, and extract
Sheet1.xml
from thexl\WorkSheets
folder before and after overwriting the values, any diff tool (e.g. winmerge makes this obvious).I have posted the XML differences on this gist.
I agree with Barry. This problem is not related to whether or not they are numbers or strings(they are all numbers). This appears to be a limitation of storing floating point numbers in binary - as described here: http://support.microsoft.com/kb/214118
This problem is not unique to excel either but rather a result of:
This phenomenon is visible here in "Arithmetic Equality":
Again this is not a problem that is unique to excel:
Good Luck.