A formula is entered into a cell. It performs a calculation of some type and returns a result, which is displayed in the cell. Formulas use a variety of operators and worksheet functions to work with values and text. The values and text used in formulas can be located in other cells, which makes changing data easy and gives worksheets their dynamic nature. For example, you can see multiple scenarios quickly by changing the data in a worksheet and letting your formulas do the work.
A formula can consist of any of these elements:
Mathematical operators, such as + (for addition) and * (for multiplication)
Cell references (including named cells and ranges)
Values or text
Worksheet functions (such as SUM or AVERAGE)
When you’re working with a table, a new feature in Excel 2007 enables you to create formulas that use column names from the table—which can make your formulas much easier to read. I discuss table formulas later in this chapter. (See the section “Using Formulas in Tables.”)
After you enter a formula, the cell displays the calculated result of the formula. The formula itself appears in the Formula bar when you select the cell, however.
Following are a few examples of formulas:
|=150*.05||Multiplies 150 times 0.05. This formula uses only values and isn’t all that useful because it always returns the same result. You may as well just enter the value 7.5 into the cell.|
|=A1+A2||Adds the values in cells A1 and A2.|
|=Income-Expenses||Subtracts the value ...|