Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mergefield calculation

Status
Not open for further replies.

Kc8889

Technical User
Jan 25, 2020
3
AE
Hi,

I encounter a syntax error in deducting «Total» to «TotalTax». Is there a way to just divide the «Total» by 1.05 or 105%?

I just need this formula in my invoice form using office365.

Soon to hear reply from you.

Thanks,
KC
 
You can use either approach. What is the formula that's giving you problems? Do note that you're liable to see '!Syntax Error' in the mailmerge main document unless you're previewing the output and, even then, you may continue to see such errors until you complete the merge.

To see how to do this a wide range of calculations in Word, check out my Microsoft Word Field Maths Tutorial, at:
or:

See also my Mailmerge Tips and Tricks thread at:

Cheers
Paul Edstein
[MS MVP - Word]
 
That's as simple as a formula field coded as:
{={MERGEFIELD Total}-{MERGEFIELD TotalTax} \# ",0.00;(,0.00)"}
or:
{={MERGEFIELD Total}+{MERGEFIELD TotalTax} \# ",0.00;(,0.00)"}
depending on whether TotalTax is a +ve or -ve value.

Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac or, if you’re using a laptop, you might need to use Ctrl-Fn-F9); you can't simply type them (which is what you've done in some cases in your document) or copy & paste them from this message. The spaces represented in the field constructions are all required.

You can probably also lose all the \* MERGEFORMAT switches in your mailmerge main document - they're unlikely to be contributing anything other than clutter.

Cheers
Paul Edstein
[MS MVP - Word]
 
Hi Macropod,

I created below formula on my template but still having a Syntax error. If it is successfully created, what would be the default value on the forms.

{={MERGEFIELD Total}-{MERGEFIELD TotalTax} \# ",0.00;(,0.00)"}

Regards,
Kc
 
Unless you ignored the Note in my previous reply, I cannot see how a syntax error is possible. The field code as posted works just fine on my system.

Cheers
Paul Edstein
[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top