I have a report created in Reporting Services that will be primarily exported to Excel. I have 10 matrices on the report, and the data cells all have a calculation like this:
=IIf(SUM(Fields!Field1.Val
ue) + SUM(Fields!Field2.Value) = 0, 0
, SUM(Fields!Field1.Value) / (SUM(Fields!Field1.Value) + SUM(Fields!Field2.Value)))
I would like the data cells for those matrices to export to Excel as a number, but they are currently formatting as text with the error "Number stored as text". I've seen many examples on the internet on how to fix this error and none of the examples worked for me. The examples I found were to convert the calculation using CDec() or CDbl(), to use a format like C2, P2, etc, or to create the value as a string like =[Calculation] & "%".
Five of the 10 matrices should be formatted as a percentage and the other five as a decimal number. What I noticed with the exported sheets is that some of them are formatted correctly and other sheets are not. When I use the P2 format (Percentage with 2 decimal places), Excel formats with 3 decimal places unless the last decimal is a zero. If I use just P, it formats 2 decimals correctly. Another weird thing is that the sheets that are formatted "correctly" have the custom format:
[$-1010409]#,##0.00#% (You can see the last pound sign that causes the third non-zero decimal place)
The sheets that are not formatted correctly are set to the "General" format. All the formulas are very similar for all the sheets, so they shouldn't change I would think. I attached a JPG showing the "correct" and incorrect sheets.
Any ideas?
Start Free Trial