FormatNumber >> Excel export?

Hi all

I want my measures to be exported(Excel) as numbers instead of text.
When i simply use them as is it does this correct but as soon
as I as the following number formating it no longer exports
correctley.

=FormatNumber(Fields!Example.Value,2,True,True,True)

The same apllies to whe  I set the formatting in the text box properties to N

Can some please tell me how I can acheive this result when exporting

Thanks in advance

G




Answer this question

FormatNumber >> Excel export?

  • qpsk

    Apply formatting using N in the Format property, then in the value textbox, apply an explicit cast of the value. E.g.

    =CDbl(Fields!Example.Value)

    Bizzare, but I've found this to work for me.



  • coefficientX

    Thanks Adam

    I came accros the same thing today when i was casting
    the values returned from custom code. I just hope the same
    principal will aplly to currency.

    In my case I had to figure to use N0
    as format type to get 1,345,456

    When using the cdbl() to do this you cant use FormatNumber(,,,)
    that was my snag.

    Thanks again for your time

    G



  • Rajesh batchu

    After personally trying the above recommendations, and having them not work for me, I determined the following:

    Let's say you want to mask-out '0' values, and you have a formula in a textbox like:

    =IIF(Fields!FieldName.Value=0,"",Cdbl(Fields!FieldName))

    ...then, regardless of performing the above recommendations (adding Cdbl()), the values will still export to Excel as text. The solution is to replace null string "" with the keyword 'Nothing', as follows:

    =IIF(Fields!FieldName.Value=0,Nothing,Fields!FieldName) (Note, the Cdbl() function is not needed at all).

    Additionally, select the textbox, press F4 to pull up properties tab, and set the 'Format' value to 'N' (or whatever format you'd like for display).

    It is as if SSRS examines the resultant column of numbers, sees a null string, and hence applies some text format for the whole column (even though you cannot see any formatting applied within Excel).

    Hope this helps...

    Rgds,
    Mojo





  • FormatNumber >> Excel export?