Can Microsoft Word handle automatic field calculations?
Albeit with some limitations and requiring a little manual work, Microsoft Word does support arithmetic calculations that can be used to tabulate costs, calculate taxes, return averages, etc. It requires are two types of fields: the number types that provide the data values to be calculated, and a calculation type that holds the formula and displays the result.
Worth keeping in mind is that this relies on the Legacy form fields, both for usability and accessibility reasons. I talk about the accessibility a little more in my article on How to design and publish accessible forms in Microsoft Word, but the short of it is that it limits what inputs we can use.
Also worth noting is that calculations do not update automatically as the user types; users must exit (or tab out of) the field before the update or calculation takes effect, which may cause confusion.
How to insert a field and modify its properties
Enable Microsoft Word's Developer tab
Hidden by default, the Developer tab provides the functions and features we'll need in order to design our form, but it first needs to be added to the ribbon menu.
- Navigate to the File tab.
- Select Options from the menu, at the very bottom.
- Select the Customize ribbon option from the menu.
- Under Select commands from, select the Main tabs from the dropdown menu.
- Select the Developer option and press the Add button.
- Press the OK button to confirm.
Locating the legacy field set
- Navigate to the Developer tab.
- In the Controls section, press the Legacy tools button.
- In the Legacy forms sub-section, select the Text form field button to insert a text field.
You can edit a field's properties by double-clicking it, right-clicking it and selecting Properties from the context menu, or pressing the Properties button in the Controls section of the ribbon menu.
Create a form with automatic calculations
This form will automatically calculate the total by multiplying a product's cost by its amount. To do this, we'll need three text inputs: one for the product's cost, one for the amount, and one to display the total.
Create the "cost" field
Insert a text form field and open its properties panel.
- Set the Type to Number.
- Set the default number to "0".
- Set the Number format to "0.00".
- Enter the Bookmark name as "Cost".
- Check the Calculate on exit option.
Create the "amount" field
Insert a second text form field and open its properties panel.
- Set the Type to Number.
- Set the default number to "0".
- Set the Number format to "0".
- Enter the Bookmark name as "Amount".
- Check the Calculate on exit option.
Create the "total" field
Insert a final text form field and open its properties panel.
- Set the Type to Calculation.
- Set the Expression value to
= Cost * Amount
. - Set the Number format to "0.00".
- Enter the Bookmark name as "Total".
Cost
and Amount
refer to the Bookmark names assigned to their respective fields.
Lock the document
When a document is locked, its contents cannot be modified. There are different types of locks, from restricting all modifications to allowing only specific actions. In this case, we only want to allow form field input while restricting all other modifications.
With the lock enabled, users can navigate between inputs using the Tab key while keeping the rest of the document unchanged. Without the lock, users may have difficulty navigating between inputs efficiently, which can be particularly challenging for those who do not use a mouse.
- Navigate to the Developer tab.
- Select Restrict Editing in the toolbar.
- Check the option Allow only this type of editing in the document.
- Choose Filling in forms from the dropdown menu.
- Press the Yes, Start Enforcing Protection button.
- Leave the password fields empty and press OK when prompted.
Test the form
Once the document is locked, use the Tab key to move between fields and enter values. As you move out of a field, the Total should automatically update.
Download a sample document
Here's a sample document you can use as a reference. Feel free to download the sample document and customize it to fit your needs.