WD: Calculation in Form Field Shows Wrong Result

Last reviewed: March 4, 1998
Article ID: Q110656
The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows NT, version 6.0
  • Microsoft Word for Windows 95, versions 7.0, 7.0a
  • Microsoft Word for the Macintosh, versions 6.0, 6.0.1, 6.0.1a
  • Microsoft Word 97 for Windows
  • Microsoft Word 98 Macintosh Edition

SYMPTOMS

When a form field calculation involves another calculated form field, the results may be incorrect.

The two scenarios below illustrate this symptom.

Scenario #1 - No formatting in the Number Format of a Form Field

   TYPE OF
   TEXTFORM                                     ACTUAL  EXPECTED
   FIELD          EXPRESSION       BOOKMARK     RESULT   RESULT
   -------------------------------------------------------------

   NUMBER         NONE             Text1         100       100
   CALCULATION    =Text1           Text2         100       100
   CALCULATION    =Text1 + Text2   Text3         100200    200

This results in doubling the value of form field 2 (Text2).

Scenario #2 - Dollar sign on either or both form fields

   TYPE OF
   TEXTFORM                                              ACTUAL  EXPECTED
   FIELD          EXPRESSION     FORMATTING      BKMRK   RESULT   RESULT
   -----------------------------------------------------------------------

   NUMBER       NONE            Dollar Sign     Text1     100       100
   CALCULATION  =Text1          Dollar Sign     Text2    $100      $100
   CALCULATION  =Text1 + Text2  Doesn't Matter  Text3    $300       200

This results in doubling the value of form field 2 (Text2).

CAUSE

Word defines the bookmarks assigned to the calculation form fields incorrectly. As a result, Word does not correctly parse these form fields; it concatenates them instead.

RESOLUTION

To resolve this problem, use any of the following methods.

Method 1: Avoid Referring to Any Other Calculation Fields

Change the final calculation to avoid referring to any other calculation fields. Include all math formulas in one calculation field. This method is only appropriate for simple calculations.

In the earlier example, because the third form field includes a formula from the second form field, the entry in the third form field expression would need to be changed to: Text1 (Bookmark from the first form field) + Text1 (Expression from the second form field).

Method 2: Redefine the Bookmarks So Word Calculates the Formula Correctly

NOTE: You must repeat this procedure each time you change a particular form field in the Text Form Field Options dialog box.

To redefine the bookmarks so Word calculates the formula correctly, use these steps with each incorrect Calculation form field:

  1. Turn on field code view by pressing ALT+F9 (Windows) or OPTION+F9 (Macintosh).

  2. Select the Calculation form field that produces incorrect results.

        Be sure to include the field brackets ({}) in the selection.
    

  3. On the Edit menu (Word 6.x, 7.x) or Insert menu (Word 97, Word 98 Macintosh Edition), click Bookmark.

        The bookmark for the selected form field is selected.
    

  4. Click Add.

        This redefines the bookmark to include the field brackets.
    

  5. Press F9 to update the field, and then press ALT+F9 (Windows) or OPTION+F9 (Macintosh) to switch back to field code results view.

The result should now be correct.

Method 3: Define a New Bookmark That Includes the First Calculation Field

NOTE: You do not need to repeat this procedure if you change the form field in the Text Form Field Options dialog box.

To define a new bookmark that includes the first Calculation field in your formula plus one space following it, follow these steps:

  1. Turn on field code view by pressing ALT+F9 (Windows) or OPTION+F9 (Macintosh).

  2. Select the first Calculation form field that is referenced in your formula (=) field. Include the space that follows this field in your selection. The selection should resemble the following example:

             { FORMTEXT {=text1}}
             ^                   ^
             |                   |
             Start of            End of
             selection           selection
    
    

  3. On the Edit menu, click Bookmark.

  4. Type a new name in the Bookmark Name box and then click Add.

  5. Turn off field code view by pressing ALT+F9 (Windows) or OPTION+F9 (Macintosh).

  6. In your second calculation field, use the bookmark you defined in step 4 above instead of the bookmark that Word set for the first Calculation form field.

Method 4: In a Table, Use Table Cell References Rather Than Bookmark Names

Use table cell references rather than bookmark names in the Calculation form field.

NOTE: This method works only if there are no other Number form fields in any table cell you reference in your Calculation form field.

For example, change this calculation

   {FORMTEXT {=Text1 + Text2}}

to the following

   {FORMTEXT {=A1 + A2}}

where the Text1 bookmark is in table cell A1 and the Text2 bookmark is in table cell A2.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

REFERENCES

"Microsoft Word User's Guide," version 6.0, pages 309-312


Additional query words: append appends
Keywords : kbproof macword winword word6 word7 word95 word97 macword98 kbfaq
Version : Windows:6.0,6.0a,6.0c,7.0,7.0a,97;Macintosh:5.0,5.1,5.1a,6.0,6.0.1,6.0.1a,9 8
Platform : MACINTOSH WINDOWS
Issue type : kbhowto


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: March 4, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.