Pages for Mac: Calculate values in Pages using data in table cells

Calculate values in Pages using data in table cells

You can create formula or function cells that automatically perform calculations using the data in any cells you select. For example, you can compare values in two cells, calculate the sum or product of cells, and so on. The result of a formula or function appears in the cell where you entered it.

You can also use any of the more than 250 predefined mathematical functions included with Pages to create formulas. There are functions for applications including statistics, engineering and finance, some of which retrieve information remotely via the Internet. Detailed information about each of these functions appears in the Functions Browser, which appears when you type an equal sign (=) in a cell, and in Formulas and Functions help online.

If you want to add an equation or expression to your document without performing a calculation, see Format an equation with MathType.

Add, subtract, multiply, or divide values

You can create simple or complex arithmetic formulas to perform calculations on the values in your tables.

  1. Click the cell where you want the result to appear, then type the equal sign (=).

    The formula editor opens. Drag the left side of the formula editor to move it. You can resize it by dragging from any of its outer edges.

    The formula editor.
  2. Click the cell to use as the first argument in your formula, or type a value (for example, a number such as 0 or 5.20).

  3. Type an arithmetic operator (for example, +, -, *, or /), then select a cell to use as the next argument in your formula, or type a value.

    By default, + is inserted between cell references.

  4. Continue adding arguments and operators until your formula is complete.

  5. Press Return or click the OK button in the formula editor when you’re done.

    If you click the Cancel button, you exit the formula editor without saving your changes.

If there’s an error in your formula, the Warning icon appears in the result cell. Click it to see the error message. If the message indicates another cell is causing the error, you can click the cell reference to select the cell with the error.

A cell error link.

Compare values

You can use comparison operators to check whether the values in two cells are equal, or if one value is greater or less than the other. To do this, you must set up a statement within a cell, for example A1 > A2, meaning the value in cell A1 is greater than the value in cell A2. The result of the comparison operator is expressed as “true” or “false.”

  1. Click the cell where you want the comparison result to appear, then type the equal sign (=).

    The formula editor opens. Drag the left side of the formula editor to move it. You can resize it by dragging from any of its outer edges.

    The formula editor.
  2. Click a cell whose value you want to compare, or type a value to compare.

  3. Type a comparison operator (>, >=, =, <>, <, or <=), then select a cell whose value you want to compare, or type a value to compare.

  4. Press Return or click the OK button in the formula editor when you’re done.

    If you click the Cancel button, you exit the formula editor without saving your changes.

If there’s an error in your formula, the Warning icon appears in the result cell. Click it to see the error message. If the message indicates another cell is causing the error, you can click the cell reference to select the cell with the error.

A cell error link.

Refer to cells in formulas

In your formulas, you can include references to cells, ranges of cells, and whole columns or rows of data—including cells in other tables and on other pages. Pages uses the value(s) in the referenced cells to calculate the result of the formula. For example, if you include “A1” in a formula, it refers to the value in cell A1 (the cell in Column A and Row 1).

The examples below show the use of cell references in formulas.

  • If the referenced range is more than one cell, the starting and ending cells are separated by a single colon.

    COUNT(A3:D7)

  • If the reference is to a cell in another table, the reference must contain the name of the table.

    Table 2::B2

    Note that the table name and cell reference are separated by a double colon (::). When you select a cell in another table for a formula, the name of the table is automatically included.

  • To refer to a column, you can use the column letter. The formula below calculates the total of the cells in the third column:

    SUM(C)

  • To refer to a row, you can use the row number. The formula below calculates the total of the cells in the first row:

    SUM(1:1)

  • To refer to a row or column with a header, you can use the header name. The formula below totals all the cells in the row with the header “Revenue”:

    SUM(Revenue)

The formula below multiplies the sum of the column named “Number of Guests” by the value in cell B2 in another table.

The Formula Editor showing a formula that refers to a column in one table and a cell in another table.

Insert functions in cells

You can use any of the more than 250 predefined mathematical functions included with Pages in your document. The Functions Browser includes examples showing how the functions work to help you choose one that suits your needs.

  1. Click the cell where you want the result of the function to appear, then type the equal sign (=).

    The formula editor opens, and the Functions Browser appears on the right side of the window, displaying a list of all the functions. For help with a function, click it.

    Drag the left side of the formula editor to move it. You can resize it by dragging from any of its outer edges.

    The formula editor.
  2. Type a function name (or terms associated with the function, such as “address”) in the search field at the top of the Functions Browser, or browse the available functions, then double-click the name of the function you want.

    The function appears in the formula editor with all of the required and optional arguments for the function.

    You can get help for the function in the Functions Browser, choose values for the arguments, show the formula as text temporarily, or convert it to text permanently by clicking arrows in the formula editor (as shown below).

    The formula editor showing the ADDRESS function and its argument tokens.

    Converting the formula to text closes the formula editor and leaves the text version of the formula in the cell.

  3. Select an argument in the function, then enter a value or select cells to include in the calculation by doing one of the following:

    • Select a cell: Click the cell.

    • Select a range of cells across multiple rows and columns: Drag across the range of cells you want to include.

    • Add the values of a single row or column: Click the column letter above the column or the row number to the left of the row—or select all of the cells in the row or column.

  4. Press Return or click the OK button in the formula editor when you’re done.

    If you click the Cancel button, you exit the formula editor without saving your changes.

If there’s an error in your formula, the Warning icon appears in the result cell. Click it to see the error message. If the message indicates another cell is causing the error, you can click the cell reference to select the cell with the error.

A cell error link.

Change an existing formula

You can edit an existing formula so that it refers to different cells.

  1. Double-click the result cell with the formula you want to edit.

    The formula editor opens, displaying the formula. Drag the left side of the formula editor to move it.

  2. Do any of the following:

    • Change the cell references: Select the existing cell addresses you want to change, then select the new cells.

    • Remove cell references: Place the insertion point within the argument area for the formula, select the unwanted cell references, then press Delete on your keyboard.

    • Add more cell references: Place the insertion point within the argument area for the formula, then select the new cells you want to add.

  3. Press Return or click the OK button in the formula editor when you’re done.

    If you click the Cancel button, you exit the format editor without saving your changes.

If there’s an error in your formula, the Warning icon appears in the result cell. Click it to see the error message. If the message indicates another cell is causing the error, you can click the cell reference to select the cell with the error.

A cell error link.

Preserve row or column addresses in formulas

You can set row and column references in a formula to be absolute so that you can use the same formula somewhere else without changing the cell references.

If you don’t preserve the row or column references, then when you move the formula (by cutting and pasting it or by adding new rows and columns), the references are adjusted relative to the formula’s new location.

  1. Double-click the result cell with the formula you want to edit.

    The formula editor opens, displaying the functions. Drag the left side of the formula editor to move it.

  2. Click the triangle on the token representing the cell range you want to preserve.

    The formula editor showing how to preserve the row and column of a range reference.
  3. Select Preserve Row or Preserve Column for the start or end addresses of the selected range.

    Formula editor with row and column references preserved.
  4. Press Return or click the OK button in the formula editor when you’re done.

    If you click the Cancel button, you exit the formula editor without saving your changes.

Published Date: Apr 3, 2018
Helpful?