TableFormula

Syntax

TableFormula [.Formula = text] [, .NumFormat = text]

Remarks

Inserts an = (Formula) field containing the specified formula at the insertion point. If the insertion point is in a table cell that already contains an = (Formula) field, the existing field is replaced with a field containing the specified formula.

Argument

Explanation

.Formula

The mathematical formula you want the = (Formula) field to evaluate. Spreadsheet-type references to table cells are valid. For example, "=SUM(a4:c4)" specifies the first three values in the fourth row.

For more information on valid formulas, display the Formula dialog box (Table menu), and then choose the Help button.

.NumFormat

A format for the result of the = (Formula) field. For sample formats, choose Formula from the Table menu and review the list in the Number Format box.


If the insertion point is in a table, specifying .Formula is optional so long as there is at least one cell containing a value above or to the left of the cell containing the insertion point. If the cells above contain values, the inserted field is {=SUM(ABOVE)}; if the cells to the left contain values, the inserted field is {=SUM(LEFT)}. If the cells above and the cells to the left contain values, Word uses the following rules to determine which SUM function to insert:

If you don't specify .Formula and all the cells above and to the left of the insertion point are empty, a field error occurs.

Example

This example adds a row to the end of the table, moves the insertion point to the last cell, and then inserts an = (Formula) field that adds the values in the last column:


TableSelectTable
EndOfRow
NextCell
EndOfRow
TableFormula .Formula = "=SUM(ABOVE)"

See Also

InsertField, TableAutoSum, ToolsCalculate