Number Format with "-" for Zero

Can someone explain to me how this format came to be? I got it from a friend but neither iof us knows why the code works, mostly the last part ( -# ;@ )

Cell Format:

[>0]#,##0.00 ;[<0](#,##0.00);-# ;@


if >0 displays 1,000.00
if <0 displays (1,000.00)
otherwise it is just -

there are 4 fields in the Formatcode (split by semicolon )

  1. positive Values
  2. negative Values
  3. only 0 (zero)
  4. is used for Text (@ is explizit TextFormatting)
3 Likes

Number format codes

1 Like

Btw, the # in “-# ” is superfluous. For a leading # a digit is displayed if not 0 (significant digits), otherwise if 0 then nothing, so as that is the 3rd subformat for 0 values (no significant digits) it’s the same as “- ”.

3 Likes

Thanks, that helped a lot to explain the different sections