Home > Mobile >  How to format complicated decimal?
How to format complicated decimal?

Time:03-21

I am trying to format a decimal with the following rules,

    56700            => 56,700 // No decimal or trailing zeros when value after decimal 
                              point is zero
    34567.25         => 34,567.25 // Show decimal and trailing values when not zero
    -34568.75        => -34,568.75 // Same as above just with minus value
    0                =>  Show blank cell when value is zero

This what I have now {0:0.00;;#.##} but this obviously does not work. I have read the docs on this but, I can't figure out how to accomplish what I am after and so I am posting here.

Any help would be greatly appreciated.

Cheers

CodePudding user response:

A specifier of

#,#.##

Seems to do what you seek

enter image description here

https://dotnetfiddle.net/JWaeGD

  • Related