WD: Calculations with Print Merge Causes Errors

Last reviewed: February 5, 1998
Article ID: Q98836
The information in this article applies to:
  • Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows 95, versions 7.0, 7.0a
  • Microsoft Word 97 for Windows
  • Microsoft Word for the Macintosh, versions 6.0, 6.0.1, 6.0.1a

In Word, you can include numeric values in a print merge data file to use in calculations in the main document. If any of the fields in the data file are blank, however, one of two error messages may appear in the merged document:

   !Unexpected End of Expression

-or-

   !Syntax Error

WORKAROUND

  • Make sure that all the fields used for calculations contain data. Type 0 (zero) in any blank field.

    The drawback to this workaround is that it could become tedious to maintain for large data files.

    -or-

  • In the calculation field in your main document, insert an IF statement that tests whether the field is blank. The following IF statement uses the value from the data file when the field is not blank; otherwise it uses 0 for the calculation:

          {= {if {MERGEFIELD num1} <> "" {MERGEFIELD num1} 0} +
          {if {MERGEFIELD num2} <> "" {MERGEFIELD num2} 0}}
    

    Note: To create the curly field brackets, press CTRL+F9 (Windows) or COMMAND+F9 (Macintosh).

For more information on using IF statement in a print merge, consult pages 639-645 in the Word for Windows "User's Guide."

REFERENCES

"User's Guide," version 2.0, pages 639-645


KBCategory:
KBSubcategory: kbmerge
Additional query words: 6.0 2.0 2.0a 2.0a-CD 2.0b 2.0c winword
word7 word6 7.0 word95 winword2 word97 6.01 6.01a 7.0a macword

Keywords : kbmerge kbprint kbualink97
Version : 2.x 6.0 6.0a 6.0c 7.0 7.0a
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 5, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.