Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Feb 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calculation expressions with Mergefields (2003)

    I am trying to get this formula to work in a Word Merge document. I cannot do the math in the data source (long story). So, I need to do the math in the expression. I have never tried to do this before so I am getting syntax errors. For example if BURGERS is 1.2, I want the field to display 1.5. If BURGERS is 1.8 I want the field to display 2.0 and so on. I think I can do this with an expression but the syntax is stopping me. Any ideas?

    {=IF(MOD({MERGEFIELD "BURGERS"},1)<.51,INT({MERGEFIELD "BURGERS"})+.5,ROUND({MERGEFIELD "BURGERS"}),0))}

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

    Re: Calculation expressions with Mergefields (2003)

    Welcome to Woody's Lounge!

    Try

    { =INT(2*{ MERGEFIELD "BURGERS" }+0.9999999)/2 }

    where the { } are field braces; you shouldn't type them yourself but use Ctrl+F9 to insert them.

  3. #3
    New Lounger
    Join Date
    Feb 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calculation expressions with Mergefields (2003)

    Hans- that worked great. Now what would I do to make the output field have a format of 0.00 ?

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

    Re: Calculation expressions with Mergefields (2003)

    By adding a format switch to the field:

    { =INT(2*{ MERGEFIELD "BURGERS" }+0.9999999)/2 # "0.00"}

    The # switch specifies the number format.

Posting Permissions

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