Symptom
- The number of decimal places is occasionally changed to 10 when the Crystal report containing the Sum field is exported to Excel file.
- Wrong decimal places in Excel file.
- Inaccurate value in Excel file.
- The issue only occurs with certain data, but the issue does not occur with other data.
Reproducing the Issue
- Create a Crystal Report.
- Click Insert > Summary.
- Choose a number type field from Choose the field to Summarize.
- Choose Sum from Calculate this Summary.
- Export the report to Excel format.
- Open the excel file, then highlight the cell containing the sum value. For instance, it reads as 87496.105903; However, it reads as 87496.1059029999 in fx field.
- Crystal Reports 2008
- Crystal Reports XI R2
Cause
It is caused by the way that Microsoft Excel stores and calculates floating-point numbers. Microsoft Excel was designed around the IEEE 754 specification with respect to storing and calculating floating-point numbers. Floating-point arithmetic may give inaccurate results in Excel.
Resolution
- Workaround 1: Creata a formula in the crystal report to explicitly truncate and round the Sum value: Truncate(Round(Sum ({Table1.value}),6),6)
- Workaround 2: In Excel, click Option > Tools > on the Calculation tab > click to select the Precision as displayed check box.
See Also
Please refer to Microsoft KBase 78113 for detailed information.
Keywords
Excel, wrong value, decimal, format , KBA , BI-RA , Reporting, analysis, and dashboards , Problem
Product
Crystal Reports 2008 V1