# WORD
## USING FORMULAS IN TABLES
If you look on the Tables and Borders toolbar you will see
the AutoSum icon which can be used to
automatically sum a column of figures. Here is a word table which
has a formula at the bottom of the second column to total the cost of the
items (£37.98), this was placed there by clicking in the cell at the
bottom of the fourth column and clicking the AutoSum icon:
If you press **ALT+F9** you will see the field code
representing the formula, press **ALT+F9** again to turn off display of
field codes.
One disadvantage of formulas in Word is that they do not
recalculate automatically if you change a figure. If we changed one
of the Total values we would need to highlight the resulting total at the
bottom of the column and press **F9** to update the total.
Although the AutoSum is useful for simple sums it can be
useful to perform more complicated calculations in a Word table. If
you use the **Table -> Formula** facility you can use other
functions such as AVERAGE, MAX, MIN and also reference individual cells in
a table.
When creating a formula you must leave the **=** sign
at the start of the calculation in the **Formula** box. By
clicking on the drop-down arrow at the right-hand end of the **Paste
function** box you can select a function to use in your
calculation. When you have selected the function you will need to
make sure the 'arguments' in the brackets are completed. As you can
see from the SUM example above you can use expressions like **SUM(ABOVE)**
in calculations. You can also use **SUM(LEFT)** to refer to all
the values to the left of the result cell. However, sometimes using **ABOVE**
and **LEFT** can cause problems, especially when the column headings in
your table contain numbers (e.g. years). To prevent Word selecting
the wrong cells you can refer to your table cells using cell references,
as you would in Excel. We can enter a formula to calculate the total
cost of the paint by using the formula **=B2*C2** (note that *****
is used for multiplication). If you need more help on creating
formulas read the pages on using formulas in Excel.
When working out the cell references for your table, label the columns **A,
B, C, D, **etc from left to right and the rows **1, 2, 3, 4,** etc
from top to bottom. Here is our table showing field codes for all
the formulae:
To ensure that your formula's result is shown in the
correct format you can se the format in the **Table -> Formula**
window using the drop-down **Number Format** list.
It is possible to create the field codes for formulae by
typing in the field code yourself. However, if you want to do this
you will have to press **CTRL + F9** to create the curly brackets
around the field code, typing the normal curly brackets **{}** on the
keyboard will not create a functioning field code. When you apply
formatting to a field code some extra information is added to the field to
define the format. Here is an example of the field code for one of the
formatted numbers above:
**{=B4*C4 \# "£#,##0.00;(£#,##0.00)"}**
To update all the field codes in your document you can
press **CTRL + A** to select the whole document and then press **F9**
to update all the field codes. |