Number field turned out as text in Excel, SSRS
Asked Answered
N

5

15

In my SSRS reports one of the fields is using this expression, where the field is a number field. I want to see blank field if the value is 0.

=IIf(Fields!PERIOD02_VALUE.Value <> 0,Fields!PERIOD02_VALUE.Value ,"")

the Excel exported version is having this field considered as text not number.

Is there any other way to do this from SSRS side?

Neodymium answered 13/3, 2009 at 17:53 Comment(0)
D
13

I had this problem. Some cells would be text and others numbers - all with the same formatting string. The resolution is to multiply your cells expression by 1.000 (1 doesn't work!) - this forces SSRS to format the cell as a number. eg; (your expression here) * 1.000

Directrix answered 4/6, 2010 at 2:28 Comment(0)
D
4

Excel is recognizing this field as text because you are outputting an empty string whenever the field is 0.

You could try this, to output a null value instead of an empty string:

=IIf(Fields!PERIOD02_VALUE.Value <> 0,Fields!PERIOD02_VALUE.Value,  Nothing)

This isn't guaranteed to work, however, as I seem to remember Excel assumes that the field is the type of whatever is in the first data row.

Dissymmetry answered 18/3, 2009 at 15:55 Comment(0)
D
4

I had this problem in the excel export and solved it with the CLng for integers and CDbl function for decimals.

=CLng(Fields!Qty.Value)

This guarantees that the excel cell will be numeric and is cleaner than Fields!Qty.Value * 1.000

Decided answered 22/6, 2016 at 22:7 Comment(2)
This should be marked as the correct answer. Thanks for your help.Chlori
Yes, I know this is old but worked for me also -- finally a solution. ThanksFermentative
W
1

The problem is that your IIF statement ends with an empty string, "". If you change that to a zero, it will work as expected:

=IIf(Fields!PERIOD02_VALUE.Value <> 0,Fields!PERIOD02_VALUE.Value, 0)

Instead of...

=IIf(Fields!PERIOD02_VALUE.Value <> 0,Fields!PERIOD02_VALUE.Value, "")
Weakkneed answered 1/8, 2018 at 13:42 Comment(0)
B
-1

Below are 3 different solutions for 3 different glitches :
Value 1

1234
blank cell
1234

Solution 2

=IIF(IsNumeric(Fields!TEST.Value.ToString()), CDBL(IIF(IsNumeric(Fields!TEST.Value.ToString()), Fields!TEST.Value.ToString(), "0")), " ")


Value 2

1234
Null
345
null

Solution 2

=IIF(IsNumeric(Fields!TEST.Value.ToString()), CDBL(IIF(IsNumeric(Fields!TEST.Value.ToString()), Fields!TEST.Value.ToString(), "0")), "NULL")


Value 3

1234
Null
345
N/A
550
TBA
440
599
NOT APPLICABLE

Solution 3

=IIF(IsNumeric(Fields!TEST.Value.ToString()), CDBL(IIF(IsNumeric(Fields!TEST.Value.ToString()), Fields!TEST.Value.ToString(), "0")), Fields!TEST.Value.ToString()),
Beaming answered 7/2, 2018 at 14:15 Comment(2)
It's not clear how these "Values" answer the question.Praedial
you can assume "Value" AS Column names ,rest are values in columnsBeaming

© 2022 - 2024 — McMap. All rights reserved.