Perform simple math in a Word document

Solution 1:

You can do formulas in Word.

CTRL+F9 will let you add a FIELD in Word in which you can type several expressions, ant ALT+F9 will show/hide all the fields in the document. You can add FIELDS inside fields themselves to build complex expressions. Fields are shown with curly brackets and each curly bracket group should be added using CTRL+F9 (or a copy/paste from another expression).

Here are some examples to get an idea:

{SET a{=INT((14-month-1)/12}}
{QUOTE{=dd*10^6+mm^10^4 \# "00'-'00'-'0000'} \@ "d MMMM yyyy"}}
{=TotalVolume*7.85 \*cardtext}

The first sets a value, the second displays a computed date, the third should correspond to an expression required in the question with "TotalVolume" already defined as a Bookmark for instance. (Remember to not type the curly braces, get them using CTRL+F9).

Any of the "variables" should be either defined using a "SET" or as a Bookmark in your document.

This feature is not used a lot, so it's not easy to find a good tutorial. A good start to learn how to use this is Microsoft's documentation. You can start with Field code - SET - it has examples futher down in its explication. You can go from there and see for instance that you can have word request data by using the FIELD CODE "FILLIN". While reading that extract, I've learned that CTRL+F9 is available through the menus from the Insert toolbar / Quick Parts / Field which may also help you to start discovering this functionnality.