*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.

**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:

- 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.
- Position the cursor in the first cell in the second column.
- Click Text Form Field on the Forms toolbar.
- Right-click the newly inserted form field and choose Properties from the resulting context menu.
- Choose Number from the Type field's drop-down list.
- From the Format Number list, choose the currency setting, $#,##0.00;($#,##0.00)
- In the Bookmark field, enter
*Price*, as shown in**Figure C**. (We'll reference the bookmarks in the formulas we enter later.) - 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 |

**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:

- Position the cursor in the fourth row's second column.
- Click Text Form Field on the Forms toolbar.
- Right-click the new form field and choose Properties from the context menu.
- From the Type field's drop-down list, choose Calculation.
- In the Expression field enter
*Price * Quantity*. (Don't delete the equal sign Word provides!) - From the Format Number list, choose the currency option, $#,##0.00;($#,##0.00)
- 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:

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

**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:

- Position the cursor in the first form field (Price) and enter a value, such as 3.
- Press Tab and Word will select the Quantity field. Enter a value, such as 2.
- 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. - 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. *