views:

73

answers:

1

When I save a SQL Report in Excel, a column containing numbers is treated as text in the resulting .xls file. On each row the cell has a green right triangle and a yellow diamond exclamation mark saying "The number in this cell is formatted as text or preceded by an apostrophe."

Can someone explain to me how to make it so the rendered report has no error for this column? My users wish to treat these cells as numeric; i.e. to perform calculations on these values, but they are text.

+1  A: 

You can get around this by casting the field within the report.

=CDbl(Fields!mycolumn.Value)

Edit The above example is the work around that I have always used for this issue, however, I just finished reading a post what the user noted that this was not needed, if you used the following code.

=IIF(Fields!FieldName.Value=0,Nothing,Fields!FieldName)

This seems to fix the issue and allow the use of FormatNumber.

The original post can be found here.

Irwin M. Fletcher
So FormatNumber returns a string? How do you combine the power of FormatNumber to insert commas, place a decimal point at a decided level?
JonathanWolfson
Also, on Excel, a cell may display as text: 60,000, but its value will be numeric: 60000. How may I cause that to happen in my SQL Reporting Definition File?
JonathanWolfson
Updated post to include additional information.
Irwin M. Fletcher