locked
Negative Numbers RRS feed

  • Question

  •  

    Anyone know how to change a negative number listed this way:

     -2.4

     

    Into a negative number in parentheses:

    (2.4)

     

    ??

    I've tried various expressions, but can't get it to work!

     

    Thanks

    Wednesday, October 1, 2008 7:58 PM

Answers

  • Use expression:

    =FormatNumber(-2.4,1,false,true)

    Replace -2.4 with your field or parameter. The 1 is number of floating points or decimal. The False is any leading character. The True is for parenthesis when negative value.

     

    Wednesday, October 1, 2008 8:48 PM
    Answerer
  • The second digit is where you specify number of decimal you want. So, in your example, it would be:

    =FormatNumber(-2.75,2,false,true).

     

    Good luck.

    Wednesday, October 1, 2008 9:50 PM
    Answerer
  • You can use this expression instead: =Format(-4.67878, "0.#######;(0.########)")

     

    Number of '#' characters determines the maximum length of the decimal part of the number. You can use any format string with the Format function. You can get more information about available formats here: http://msdn.microsoft.com/en-us/library/0c899ak8.aspx

     

    Alex.

     

    Wednesday, October 1, 2008 9:54 PM

All replies

  • Use expression:

    =FormatNumber(-2.4,1,false,true)

    Replace -2.4 with your field or parameter. The 1 is number of floating points or decimal. The False is any leading character. The True is for parenthesis when negative value.

     

    Wednesday, October 1, 2008 8:48 PM
    Answerer
  • That worked, but I noticed some of the numbers rounded up.  I don't think I want it to do that!

     

    Ex: -2.75 became (2.8)

     

    Thanks Isham - you're the best at Expressions!

     

     

    Wednesday, October 1, 2008 9:12 PM
  • The second digit is where you specify number of decimal you want. So, in your example, it would be:

    =FormatNumber(-2.75,2,false,true).

     

    Good luck.

    Wednesday, October 1, 2008 9:50 PM
    Answerer
  • You can use this expression instead: =Format(-4.67878, "0.#######;(0.########)")

     

    Number of '#' characters determines the maximum length of the decimal part of the number. You can use any format string with the Format function. You can get more information about available formats here: http://msdn.microsoft.com/en-us/library/0c899ak8.aspx

     

    Alex.

     

    Wednesday, October 1, 2008 9:54 PM
  • Thanks, Alex - I will try that one too!

     

    Wednesday, October 1, 2008 10:47 PM