The values that you save in an XML spreadsheet do not match the values that appear in Excel 2002 and in Excel 2003 (328996)



The information in this article applies to:

  • Microsoft Office Excel 2003
  • Microsoft Excel 2002

This article was previously published under Q328996

SYMPTOMS

When you save a spreadsheet in the XML Spreadsheet (XMLSS) format in Excel 2002, the numbers in the resulting XMLSS file may not match what appears in Excel 2002. Mismatched numbers also appear if you use the Range.Value method in Microsoft Visual Basic for Applications (VBA) with the xlRangeValueXMLSpreadsheet value or the xlRangeValueMSPersistXML value.

This article discusses why this problem can occur when you save a file in the XMLSS format.

CAUSE

This problem occurs because Microsoft Excel was designed around the IEEE (Institute of Electrical and Electronics Engineers) 754 specification regarding storing and calculating floating-point numbers. IEEE is an international body that, among other things, determines standards for computer software and hardware. The IEEE 754 specification is a very widely adopted specification that describes how floating-point numbers must be stored in a binary computer. It is popular because it permits floating-point numbers to be stored in a reasonable space and for calculations to occur relatively quickly.

When a file is saved in the XMLSS format, numbers are stored in the XMLSS file as floating-point numbers. When the file is re-opened in Excel, they appear as they were entered. However, if the XMLSS file is used by another program, they are imported as they appear in the XML tags. For additional information about how Excel stores numbers, click the following article number to view the article in the Microsoft Knowledge Base:

78113 Floating-point arithmetic may give inaccurate results

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

The following blocks of code are examples that would cause mismatched numbers unless the worksheet is structured correctly:
Range("A1:A4").Value(xlRangeValueXMLSpreadsheet)
and
Range("A1:A4").Value(xlRangeValueMSPersistXML)

Modification Type:MajorLast Reviewed:3/8/2005
Keywords:kbbug kbpending KB328996