To assign a formula to a particular field, type it directly into the field, preceded by ‘:=’, for example ‘:=vsum(@II..III)’. When you press TAB or RET or C-c C-c with the cursor still in the field, the formula will be stored as the formula for this field, evaluated, and the current field will be replaced with the result.
Formulas are stored in a special line starting with ‘#+TBLFM:’ directly
below the table. If you type the equation in the 4th field of the 3rd data
line in the table, the formula will look like ‘@3$4=$1+$2’. When
inserting/deleting/swapping column and rows with the appropriate commands,
absolute references (but not relative ones) in stored formulas are
modified in order to still reference the same field. To avoid this from
happening, in particular in range references, anchor ranges at the table
$>), or at hlines
@I notation. Automatic adaptation of field references does
of course not happen if you edit the table structure with normal editing
commands—then you must fix the equations yourself.
Instead of typing an equation into the field, you may also use the following command
Install a new formula for the current field. The command prompts for a formula with default taken from the ‘#+TBLFM:’ line, applies it to the current field, and stores it.
The left-hand side of a formula can also be a special expression in order to
assign the formula to a number of different fields. There is no keyboard
shortcut to enter such range formulas. To add them, use the formula editor
(see Editing and debugging formulas) or edit the
Column formula, valid for the entire column. This is so common that Org treats these formulas in a special way, see Column formulas.
Row formula, applies to all fields in the specified row.
the last row.
Range formula, applies to all fields in the given rectangular range. This can also be used to assign a formula to some but not all fields in a row.
Named field, see Advanced features.