Software

10 steps to creating a calculating Word form

Word offers the tools you need to handle simple calculations within your documents. This walk-through demonstrates the process.

Word offers the tools you need to handle simple calculations within your documents. This walk-through demonstrates the process.


When performing mathematical equations, we usually turn to Excel, but Word can handle low-level calculations. The process isn't necessarily intuitive, but it's easy once you know how to use the proper tools. If you store values and formulas in a Word form field, Word can apply a data type to the data rather than interpreting everything as normal text. Form fields can store static values and formulas. Bookmarking the form field allows you to enter bookmark names in formulas, in essence using them as variables. In this example, you'll create a sales form that calculates totals, but the steps are generally the same regardless of your calculating task. Only the values and formulas will change.

Note: This article is also available as a PDF download.

Step 1: Determine your needs

The first step to creating a calculating form is to determine the values you need to store and how the form will evaluate those values mathematically. For instance, let's suppose you want to use a Word document to calculate the total purchase price of a particular item. In that case, you might need the following information:

  • The product's price
  • The quantity purchased
  • Current tax, if applicable

The information will vary from task to task, but before you do anything, determine the static values the form will need to store and evaluate. (By static, we mean a literal value and not the result of a calculation.)

Step 2: Flesh out the calculations

By referring to static values (Step 1) in formulas, you can calculate extended information. Before you start entering operators and operands, though, it's a good idea to work the formulas out with pen and paper. In the case of our example sales form, you might want a subtotal -- the result of multiplying the product's price by the number of items sold. You'll definitely want a grand total -- the subtotal plus any applicable tax. Both formulas follow:

Subtotal: =Price * Quantity
Grand Total: =Subtotal * Tax + Subtotal

Step 3: Design the form -- use a table

Once you've listed all the static values and formulas, you're ready to start building the form. Tables aren't a prerequisite for adding calculating fields, but we recommend them because they help manage your data. For instance, Figure A shows the table that will store and display values for our line item sales form.

Figure A: Use tables to corral and manage values.

To create the table, choose Insert from the Table menu and select Table. In the Insert Table dialog box, specify two columns, five rows, and click OK. Then, enter the appropriate heading text in the left column.

Step 4: Display the Forms toolbar

With your table ready, it's time to start entering form fields, which allow you to enter data at a specific location. Our example needs form fields to store the three static values and two formulas. Form fields provide a data type and use formulas that can refer to those values, similar to using a variable.

Form fields aren't available from the standard menu or toolbar. You'll need the Forms toolbar (Figure B), which you can display by right-clicking any menu or toolbar and choosing Forms. We'll use the Text Form Field button to insert form fields into the table.

Figure B: Display the Forms toolbar so you can insert form fields.

Step 5: Insert a text form field

A text form field stores several types of data: text, numbers, symbols, and dates. It's a little strange to store numeric and date values as text, but don't let the term confuse you. This type of form field doesn't limit the field to storing data strictly as text.

To insert a form field for storing the product price value, you'll need a Number type, which you can insert as follows:

  1. Press [Alt]+F9 to display field codes. Form fields are easier to work with if you can see the actual field codes while building the form.
  2. Position the cursor in the first cell in the second column.
  3. Click Text Form Field on the Forms toolbar.
  4. Right-click the newly inserted form field and choose Properties from the resulting context menu.
  5. Choose Number from the Type field's drop-down list.
  6. From the Format Number list, choose the currency setting, $#,##0.00;($#,##0.00)
  7. In the Bookmark field, enter Price, as shown in Figure C. (We'll reference the bookmarks in the formulas we enter later.)
  8. Click OK.

Figure C: Enter Price in the Bookmark field.

Step 6: Insert text form fields for the remaining static values

There are two other static values, Quantity and Tax. Refer to Table A and using the process discussed in Step 5, enter two more text form fields.

Table A

Type Format Bookmark Calculate On Exit
Number 0 Quantity Check
Number 0% Tax Check

Be sure to select the Calculate On Exit setting for both static form fields. That will force Word to calculate the form's formulas (which you haven't entered yet) when you press Tab to leave that form field. At this point, the form has three form fields as shown in Figure D.

Figure D: This form has three text form fields.

Step 7: Insert a calculating form field for the subtotal

The three form fields store static values -- the product's price, the quantity sold, and any applicable tax. Now, it's time to add a calculating form field that will subtotal cost. Add the subtotaling form field as follows:

  1. Position the cursor in the fourth row's second column.
  2. Click Text Form Field on the Forms toolbar.
  3. Right-click the new form field and choose Properties from the context menu.
  4. From the Type field's drop-down list, choose Calculation.
  5. In the Expression field enter Price * Quantity. (Don't delete the equal sign Word provides!)
  6. From the Format Number list, choose the currency option, $#,##0.00;($#,##0.00)
  7. Enter Subtotal in the Bookmark field, as shown in Figure E, and click OK.

Figure E: The Expression field stores simple formulas.

Figure F shows the form's first calculating field. (We've increased the width of the column just a bit so you can see the field code unwrapped.) The code includes the formula, which refers to two of the static values, bookmarked as Price and Quantity.

Figure F: A calculating form field includes the field's formula.

Step 8: Insert a calculating form field for the grand total

Now you're ready to create a form field that will calculate the grand total. This one's a little more complex, because you must calculate the tax and add it to the subtotal. To create this calculating field, do the following:

  1. Position the cursor in the last row's second column.
  2. Click Text Form Field on the Forms toolbar.
  3. Right-click the form field and choose Properties.
  4. From the Type field's drop-down list, choose Calculation.
  5. In the Expression field enter Subtotal + (Subtotal * Tax)
  6. From the Format Number list, choose the currency option, $#,##0.00;($#,##0.00)
  7. Enter GrandTotal in the Bookmark field and click OK.

You've now inserted all five form fields. Figure G shows the completed form.

Figure G: This form has five form fields: three store static values and two store formulas that refer to those static values.

Step 9: Protect the document

Before you use the document, you should protect it so that users can't inadvertently alter (mess up) your form fields. To do so, click Protect Form on the Forms toolbar (that's the icon that looks like a padlock.)

Step 10: Use the form!

With the form fields protected, you're ready to use the form. Simply enter values and watch how the calculating form fields update. To use the form, do the following:

  1. Position the cursor in the first form field (Price) and enter a value, such as 3.
  2. Press Tab and Word will select the Quantity field. Enter a value, such as 2.
  3. Press Tab and Word will select the Tax field and calculate the two calculating fields, as shown in Figure H. Right now, there's no tax figured into the purchase.
  4. Enter a tax value, such as .06 and press Tab. Figure I shows the result of the grand total evaluating the tax value.

Figure H: The form calculates both form fields.

Figure I: Now the two calculating formulas have all the data they need to return different totals.


Tina Norris Fields, M.A. Leadership, B.S. Bus-CIS, is the owner of Tall Pines Computer Training and specializes in facilitating adult computer mastery.

15 comments
jclarson
jclarson

You are calculating based on bookmarks, so it doesn't matter where the fields are located in the document. In fact, you don't even have to use a table. (the author probably did that to make the formatting nicer) Just be sure to use unique values in the "Bookmark" option of your fields, then use those bookmark values in the formula of your calculated field.

S_Bryan
S_Bryan

Is it possible to separate the "cells" of the table? I need to be able to calculate numbers in different parts of a document (a contract), so that when I enter "x" in one spot and "y" in one spot of the document, "z" is automatically calculated in another part of the document. Please let me know if this is possible! Would be extremely helpful! If it is and I have just misread instructions, please forgive me. Thanks.

vmswilliamson
vmswilliamson

Thanks so much. I did a lot of searching on the web trying to figure out how to have multiple form fields automatically tally. No one provided the clear instructions the way you have. I followed them and my form is working great. Thanks again.

phnguyen
phnguyen

It does not work perfectly as demonstration. When I try to alter the ?Price? & ?Quantity? fields, the result was not recalculated. I try to open the ?property? box and it works.

pareshkamat
pareshkamat

Instructions were followed but then it didnt work

Andy Roberts
Andy Roberts

Useful to learn about form fields but I've tried it and mine mysteriously doubles the subtotal in the Grand Total (12.72 instead of 6.72). If I put Grand Total formula as '= Subtotal' it doubles the Subtotal! But if I put '= Price) is shows the price. Doesn't Calculations on calculation fields work? (Using Word 2002 SP3)

phnguyen
phnguyen

It does not work perfectly as demonstration. When I try to alter the ?Price? & ?Quantity? fields, the result was not recalculated. I try to open the ?property? box and it works.

phantom56
phantom56

To keep the form working, check the Calculate on Exit box for the three input fields in Word 2003. I also had to delete the spaces in the formulas displayed in the article (Price*Quantity), etc.

ssharkins
ssharkins

Please describe what's happening. There are two common problems that I routinely see when using this technique: 1.) Incorrect bookmark references. 2.) Incorrect formula syntax. Another thing you might want to check in this particular example is the Tax value -- you should enter it as a decimal value, however, I think the erroring result would make that mistake more obvious.

chellbellding
chellbellding

@Andy Roberts  

I'm using Microsoft Office Professional Plus 2010 and I'm having the same problem as Andy. It doubles the amount for the Tax in the Grand Total. I've been fighting with this for hours, and I've checked every possibility. Has anyone found a solution to this?

LewesMariner
LewesMariner

Worked fine in 2007. Might be worth checking the bookmark names for the cells. I got Word to give erratic answers (though not the same behaviour as Andy) when I labelled both the subtotal and grand total amounts with the bookmark subtotal - clearly not too good on circular references!

ssharkins
ssharkins

Make sure the appropriate OnExit options are set.

didfrost
didfrost

Firstly, I had failed to make form alive, but when I check check-box: "calculate on exit" it began to work. Thank author for useful tip.

LLL3
LLL3

@chellbellding @Andy Roberts  @Andy RobertsI have consistently had a similar problem.  In Word 2007 and 2010.  I just had a client email me about the same problem today so I was researching it and found this column (4 years later...).  What I have found is that I cannot include a reference to a calculation field in a calculation.  When I do, the result shows up twice.  I have to rewrite the formula to NOT use the subtotal field. 

Like this for the grand total:

=(Price*Quantity)+(Price*Quantity*tax)

I am wondering why others do not seem to have this problem as it has always happened to me, consistently, on multiple computers.

ssharkins
ssharkins

I'm always glad with the solution is something simple!

Editor's Picks