WD: Performing Calculations in a Mail Merge FieldLast reviewed: February 5, 1998Article ID: Q90488 |
The information in this article applies to:
SUMMARYWord can perform calculations using the values from bookmarks or print merge MERGEFIELD fields.
MORE INFORMATIONYou can use an EXPRESSION (=) field to perform calculations on the values represented by bookmarks or print merge fields. For example, to multiply the value in the Term field by 2, insert the following field:
{=Term * 2}To make a calculation using a MERGEFIELD field, use the following format (versions 2.0 and later of Word for Windows only):
{= ({MERGEFIELD order} + 100)}Note that the MERGEFIELD field is nested in the EXPRESSION field. The result of the calculation appears in the print merged documents.
Multiple Calculations in an EXPRESSION FieldYou can perform multiple calculations in one EXPRESSION field. The below sample will multiply .825 by the {Mergefield amnt} if the {Mergefield state} is equal to NY otherwise it will multiply {Mergefield amnt} by .725 if it is any other state.
{IF {MERGEFIELD State} = "NY" {=({MERGEFIELD amnt} * .825} {=({Mergefield amnt} * .725)}}General:
{IF {Mergefield name} = "Mergefield" {=({Mergefield name} * .825} Else {=({Mergefield name} * .725)}}Below is a sample table.
State amnt NY 100 TX 100 Multiple Fields in an EXPRESSION FieldYou can use two or more bookmark or MERGEFIELD fields in EXPRESSION fields. In the following examples, if the value of FIELD1 is 100 and the value of FIELD2 is 200, the result of the calculation, or 300, appears in the print merged document:
{=BOOKMARK1 + BOOKMARK2} {={MERGEFIELD FIELD1} + {MERGEFIELD FIELD2}}For more information about the operators you can use in mathematical calculations, use the Help menu to search on "Expression Field," or see page 304 of the version 2.0 "Microsoft Word for Windows User's Guide," or see pages 27 and 95-96 of the versions 1.x "Microsoft Word for Windows User's Reference."
REFERENCES"Microsoft Word for Windows User's Guide," version 2.0, page 304 "Microsoft Word for Windows User's Reference," version 1.x, pages 27, 95-96 "Microsoft Word for Windows and OS/2 Technical Reference," pages 336- 342
|
KBCategory: kbusage
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |