Next: Column formulas, Previous: Formula syntax for Lisp, Up: The spreadsheet

#### 3.5.4 Field formulas

To assign a formula to a particular field, type it directly into the field, preceded by ‘`:=`’, for example ‘`:=$1+$2`’. 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 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. Of course this is not true if you edit the table structure with normal editing commands—then you must fix the equations yourself. The left-hand side of a formula may also be a named field (see Advanced features), or a last-row reference like ‘`$LR3`’.

Instead of typing an equation into the field, you may also use the following command

`C-u C-c = (``org-table-eval-formula``)`
  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.