Entering Formulas

Formulas can be entered simply by typing a syntactically correct formula in a cell. The correct syntax for formulas is explained in detail in Section 5.2.4 ― Formula Elements. Formulas begin with an equals sign (=) and contain arithmetic symbols, functions with their arguments and cell references.

To enter a formula, first the cell must be selected, then the correct formula must be typed, and finally the Enter key must be typed.

If the formula entered into Gnumeric cannot be interpreted correctly, Gnumeric will display an error message giving the user the choice of re-editing the formula or saving the formula as a text field to be edited later. For example, a formula may be mathematically incorrect if the user has two operators in a row (e.g. =3+*4). If the formula is saved as text, when the formula is corrected the leading apostrophe must be removed. Gnumeric will then re-interpret the entry as a formula.

5.3.5.1. Shortcuts for including cell references and ranges in formulas

Formulas often include cell references or references to ranges of cells as arguments to functions. These references and ranges can be entered into a formula simply by typing in the proper syntax (see Section 5.2.4.3 ― Cell Referencing for more details). But manually entering in cell ranges is slow and cumbersome. In order to speed up the entry of these cell ranges, the mouse and the keyboard arrow keys can be used to select these cell ranges quickly.

When editing a formula, if the cursor is at a point where a cell reference or range would be appropriate, the reference or range can be selected using the mouse. If the mouse is used to click on a cell, the reference of that cell will be entered into a formula. Alternatively, if the mouse is used to drag a selection over a range of cells, that cell range will become part of the formula. The selected range will be highlighted by a border of moving black dashes, commonly called the "marching ants" border.

Figure 5-2The highlighted selection
Using the mouse to enter cell references
  1. Begin entering a formula as you would normally. Stop at the point where a cell reference is appropriate. For example, example, type =exp(

  2. Click on the cell you want to reference. Its reference will be entered into the formula.

  3. To finish the formula, just type in the closing parenthesis. This will also "unselect" the region.

The mouse can be used to select a single cell, a continuous range of cells or several disjoint ranges of cells just like regular selections.

If entering lots of formulas or even just entering a few formulas, it is often quickest to use the keyboard to select cells and ranges of cells for use in formulas. Just as reaching a input point allows the user to select cells with the mouse, it is possible to use the keyboard to select cells. Just use the cursor keys and selection modifiers to create a selection.

Using the keyboard to enter cell references
  1. Select a cell to enter a formula into. For example A1.

  2. Enter a formula, but stop the cursor at a point where a cell reference is appropriate. For this example, =SUM(

  3. Move the selection around with the cursor keys. Move the selection cursor to cell B1 to start the selection.

  4. Hold down Shift and move the selection one cell over and one cell down. Cells B1,B2,C1,C2 should now be selected and the formula should show =sum(B1:C2

  5. To finish the function, close the parenthesis. The cell should now show =sum(B1:C2). Press enter and the formula is entered.

To select a range of cell, hold Shift and move over the desired area.

To stop entering a selection or to start over, press Shift+Backspace

5.3.5.2. Entering formulas using the function list

5.3.5.3. Entering formulas using the formula guru