How to Create Formulas in Microsoft Office Excel 2007

Formulas are equations that perform calculations on values in your worksheet. A formula starts with an equal sign (=). For example, the following formula multiplies 2 by 3 and then adds 5 to the result.

=5+2*3

A formula can also contain any or all of the following:

functions (function: A prewritten formula that takes a value or values, performs an operation, and returns a value or values. Use functions to simplify and shorten formulas on a worksheet, especially those that perform lengthy or complex calculations.),

references,

operators (operator: A sign or symbol that specifies the type of calculation to perform within an expression. There are mathematical, comparison, logical, and reference operators.), and

constants (constant: A value that is not calculated and, therefore, does not change. For example, the number 210, and the text "Quarterly Earnings" are constants. An expression, or a value resulting from an expression, is not a constant.).


Parts of a formula

1 Functions: The PI() function returns the value of pi: 3.142...
2 References: A2 returns the value in cell A2.
3 Constants: Numbers or text values entered directly into a formula, such as 2.
4 Operators: The ^ (caret) operator raises a number to a power, and the * (asterisk) operator multiplies.

Create a formula with nested functions

Nested functions use a function as one of the arguments of another function. You can nest up to 64 levels of functions. The following formula sums a set of numbers (G2:G5) only if the average of another set of numbers (F2:F5) is greater than 50. Otherwise it returns 0.

1 The AVERAGE and SUM functions are nested within the IF function.

  1. Click the cell in which you want to enter the formula.
  2. To start the formula with the function, click Function Wizard on the formula bar (formula bar: A bar at the top of the Excel window that you use to enter or edit values or formulas in cells or charts. Displays the constant value or formula stored in the active cell.) .
  3. Select the function you want to use. You can enter a question that describes what you want to do in the Search for a function box (for example, "add numbers" returns the SUM function), or browse from the categories in the Or Select a category box.
  4. Enter the arguments (argument: The values that a function uses to perform operations or calculations. The type of argument a function uses is specific to the function. Common arguments that are used within functions include numbers, text, cell references, and names.).
    • To enter cell references as an argument, click Collapse Dialog next to the argument you want (which temporarily hides the dialog box), select the cells on the worksheet, and then press Expand Dialog .
    • To enter another function as an argument, enter the function in the argument box that you want. For example, you can add SUM(G2:G5) in the Value_if_true edit box of the IF function.
    • The parts of the formula displayed in the Function Arguments dialog box reflect the function that you selected in the previous step. For example, if you clicked IF, Function arguments displays the arguments for the IF function.
Create a formula with references and names

The following formulas contain relative references (relative reference: In a formula, the address of a cell based on the relative position of the cell that contains the formula and the cell referred to. If you copy the formula, the reference automatically adjusts. A relative reference takes the form A1.) to and names (name: A word or string of characters that represents a cell, range of cells, formula, or constant value. Use easy-to-understand names, such as Products, to refer to hard to understand ranges, such as Sales!C20:C30.) of other cells. The cell that contains the formula is known as a dependent cell when its value depends on the values in other cells. For example, cell B2 is a dependent cell if it contains the formula =C2.

Example formula What it does
=C2 Uses the value in the cell C2
=Sheet2!B2 Uses the value in cell B2 on Sheet2
=Asset-Liability Subtracts a cell named Liability from a cell named Asset
  1. Click the cell in which you want to enter the formula.
  2. In the formula bar (formula bar: A bar at the top of the Excel window that you use to enter or edit values or formulas in cells or charts. Displays the constant value or formula stored in the active cell.) , type = (equal sign).
  3. Do one of the following:
    • To create a reference, select a cell, a range of cells, a location in another worksheet, or a location in another workbook. This behavior is called semi-selection. You can drag the border of the cell selection to move the selection, or drag the corner of the border to expand the selection.


      1 The first cell reference is B3, the color is blue, and the cell range has a blue border with square corners.

      2 The second cell reference is C3, the color is green, and the cell range has a green border with square corners.


      Note If there is no square corner on a color-coded border, then the reference is to a named (name: A word or string of characters that represents a cell, range of cells, formula, or constant value. Use easy-to-understand names, such as Products, to refer to hard to understand ranges, such as Sales!C20:C30.) range.
    • To enter a reference to a named range, press F3, select the name in the Paste name box, and click OK.
  4. Press ENTER.
Create an array formula that calculates a single result

You can use an array formula to perform several calculations to generate a single result. This type of array formula can simplify a worksheet model by replacing several different formulas with a single array formula.

  1. Click the cell in which you want to enter the array formula.
  2. Type the array formula.

    For example, the following calculates the total value of an array of stock prices and shares, without using a row of cells to calculate and display the individual values for each stock.

    Array formula that produces a single result

    When you enter the formula {=SUM(B2:C2*B3:C3)} as an array formula, it multiples the Shares and Price for each stock, and then adds the results of those calculations together to get a total value of 9500.
  3. Press CTRL+SHIFT+ENTER.

    Microsoft Office Excel automatically inserts the formula between { } (braces).

Important When you edit the array formula, the braces ({ }) do not appear in the array formula, and you must press CTRL+SHIFT+ENTER again.

Create an array formula that calculates multiple results

Some worksheet functions return arrays of values, or require an array of values as an argument. To calculate multiple results with an array formula, you must enter the array into a range of cells that has the same number of rows and columns as the array arguments have.

  1. Select the range of cells in which you want to enter the array formula.
  2. Type the array formula.

    For example, given a series of three sales figures (column B) for a series of three months (column A), the TREND function determines the straight-line values for the sales figures. To display all of the results of the formula, it is entered into three cells in column C (C1:C3).

    Array formula that produces multiple results

    When you enter the formula =TREND(B1:B3,A1:A3) as an array formula, it produces three separate results (22196, 17079, and 11962), based on the three sales figures and the three months.
  3. Press CTRL+SHIFT+ENTER.

    Excel automatically inserts the formula between { } (braces).

    Important When you edit the array formula, the braces ({ }) do not appear in the array formula, and you must press CTRL+SHIFT+ENTER again.




Share this page with your friends