Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    164
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Mergefield (2003)

    I have the following mergefield:

    { MERGEFIELD "BLBAL1" #$,0.00 }

    When I have a negative dollar amount, the amount is displayed like so: $-10,877.34

    Is it possible to switch the format to display like this instead: ($10,877.34)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Mergefield (2003)

    Try this:

    { MERGEFIELD "BLBAL1" # "$#,##0.00;($#,##0.00)" }

    The second section in the format switch specifies the format for negative numbers.

  3. #3
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    164
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Mergefield (2003)

    That did it! Thank you! Just curious, why do I need the # signs before the zeros?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Mergefield (2003)

    In a format string, 0 stands for a required digit (a 0 will be displayed if there is no digit in that position), and # for an optional digit that will only be displayed if it is available.

    <code>#,##0.00</code> says: always display one digit before the decimal point, and two after it. If there are more digits before the decimal point, display them with a comma in between each group of 3 digits.

  5. #5
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,055
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Mergefield (2003)

    Hi Hans,

    The description you gave is correct for '# ,0.00' but not '#,##0.00'.

    The '#,##0.00' part really says: always display one digit before the decimal point, and two after it. If there are more <font color=red>than 3</font color=red> digits before the decimal point, display them with a comma in between each group of 3 digits <font color=red> but, if there are less than 4 digits, pad the missing digit positions with spaces</font color=red>.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Mergefield (2003)

    Thanks for the correction! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •