# Microsoft Excel XP Tutorial Section Learning Goals In this section, you will learn: How to work with worksheets Basic formulas Constructing a formula Excel functions Using the formula palette Absolute and relative cell references Protecting a worksheet

## Excel Worksheets

### Basic Formulas

A formula is an equation that calculates a value for a cell or a range of cells. You enter a formula into the formula bar preceded by an equal (=) sign. This tells Excel to calculate a value for what you’ve entered, rather than treating your entry as plain text. Formulas can be very simple-such as addition or subtraction-or very complex, performing multiple calculations and referencing additional formulas in numerous cells.

Formulas remain behind the scenes; that is, cells display the resulting values of the formulas you’ve entered, rather than the formulas themselves. Because formulas can refer to other cells in a worksheet, other worksheets, or even other workbooks, the value of a cell containing a formula will change as the contents of the referenced cells change.

For example, if you want to calculate the total number of widgets you sell in the year 2004, and for each month of the year you have a cell containing the total number of sales that month, you can enter a formula into a “Total Annual Sales” cell to add together the sales for each month. By the end of June, you may have only sold 715 widgets: But by the end of the year, as new figures are added for the remaining months, your total widget sales may climb to over 1,300: As you can see, Excel automatically updates this total as figures are entered into the cells for monthly sales totals.

Note that in the example above the formula that calculates the value for the total annual sales actually refers to cells containing formulas of their own. Cell B6 adds together the contents of cells B2 through B4; cell C6 adds together the contents of cells C2 through C4; and so on. Cell C9, which calculates the total annual sales, adds together the values of cells B6 through M6. Thus, Excel can calculate values that are then used to calculate new values for other cells.

### Constructing a Basic Formula

To enter a formula into a cell:

1. Select the cell.
2. In the formula bar, enter an equal (=) sign, and then type the formula.
3. Press Enter.

Similarly, you can view a formula contained in a cell by clicking the cell. When the cell is selected, the formula is displayed in the formula bar. To edit the formula, you simply change it in the formula bar and press Enter.

The simplest formulas can use familiar operators, such as:

• The plus sign (+) for addition
• The minus sign (-) for subtraction
• The asterisk (*) for multiplication
• The backslash (/) for division

Excel calculates formulas using standard mathematical rules; specifically, values are calculated from left to right, with any operations contained in parenthesis performed first.

For example, if you want to calculate the average sales among all three widgets for the month of January, you might enter the following formula into a new cell below the monthly total:

=(B2+B3+B4)/3

In this formula, “B2” refers to the value contained in cell B2; “B3” refers to the value contained in cell B3; and “B4” refers to the value contained in cell B4. If you later change the value of one of those cells-for example, you find 46 units of Widget 1 were sold, and not 45-Excel will update the total.

The number “3” in the formula is a constant-a value that doesn’t change, unlike the cell references, whose values can change if you edit the data in the cells. When you press Enter, Excel calculates the value and displays it in the cell. In the example above, it isn’t necessary to include the parentheses in the formula, since Excel calculates the values from left to right. However, using parentheses to indicate a combined value (in this case, the total of three cells) is often helpful, particularly in more complex formulas.

The formula can be further simplified by replacing the three referenced cells with a single reference to the cell containing the formula that calculates January’s total sales, cell B6:

=B6/3

### Excel Functions

Excel provides many built-in formulas, called functions, which make it much simpler to perform calculations. In the last section, the following formula was used:

=(B2+B3+B4)/3

“B2”, “B3”, and “B4” represented the number of widgets sold in the month of January. “B2” represented Widget 1 sales, “B3” Widget 2 sales, and “B4” Widget 3 sales, as shown in the sample spreadsheet below: To calculate the total number of sales for the month of January, you could enter the formula =B2+B3+B4 into cell B6 (next to Total). However, it’s easier to use the SUM function, particularly when you’re adding together a large number of cells in a range:

=SUM(B2:B4)

Functions begin with the name of the function (for example, “SUM”) followed by parentheses enclosing the specific values being calculated (called arguments). These values can be constants, cells references, or even text you want to combine. To refer to a range of cells, type the first cell in the range, then a colon (:), and then the last cell in the range (for example, “B2:B4”).

You enter a formula that uses a function the same way you’d enter any other formula: select the cell, type an equal sign (=) and then the formula, with its function, in the formula bar, and press Enter. Excel calculates the value and displays it in the cell.

Functions simplify formulas by telling Excel to use a predefined method of calculating values. Microsoft Excel includes functions for calculating averages, statistics, dates, and much more. In many cases, you need only supply simple data, such as the range of cells to be used in the calculation.

### Using the Formula Palette

Excel’s Formula Palette can help you construct formulas that contain functions by displaying a list of the built-in functions and the arguments used for each. To access the Formula Palette:

1. Select the cell in which you want to enter the formula.
2. Click the Edit Formula button in the formula bar.
3. The Formula Palette opens. 1. From the Functions drop-down menu, select a function that describes the type of calculation you want to perform.  Tip:

Select More Functions to see additional functions.

When you select a function, the Formula Palette displays fields in which you can enter the arguments (the values to be calculated), as well as a description of the function and the current result of the calculation. In the example above, the AVERAGE function has been selected. The AVERAGE function adds together the values (called arguments) you supply and then divides this total by the number of values that were added, which Excel calculates for you. In this function, you only need supply the values whose average you want to calculate.

1. Enter the values you want calculated into the Number 1 field.

By default, Excel has assumed you want to use the values of the range of cells above the cell containing the formula (B2:B6). This range can be deleted and another one can be entered, and the formula displayed in the formula bar will change accordingly. Alternatively, you can enter constants separated by commas, such as “3,5,7,9”, in which case Excel will calculate the average of the numbers 3, 5, 7, and 9.

Below, “B6” has been changed to “B4” so Excel will calculate the average of the values in cells B2 through B4.  Tip:

If you like, you can hide the Formula Palette and use your mouse to select the range of cells whose values you want Excel to use in the formula:

1. Click the button to the right of the Number 1 field .

The Formula Palette disappears, leaving only the field. 1. If necessary, delete the existing contents of the field. Then select the range of cells you want to use in the formula. As you select the cells, Excel enters the range into the field, updating it as you move your mouse.

1. Click the button to the right of the field to display the Formula Palette again.
1. When you’ve finished entering the values for your function, click OK to close the Formula P
alette.

Excel calculates the value and displays it in the cell. ### Absolute and Relative Cell References

By default, Excel uses relative cell references. Relative cell references are those whose locations Excel calculates based on the location of the formula. This means that when you insert a new row or column into a range included in a formula, Excel automatically includes the new data in its calculations, and edits the formula accordingly. Similarly, when you copy a formula from one cell to another, Excel adjusts the cell references.

For example, you can copy the formula in cell B6 below (which adds together the values in the range B2:B4) to cell C6, and Excel will adjust the formula to add together the values in the range C2:C4. This is because the cell range used in the original formula is relative-it tells Excel to use the values in the cells 4, 3, and 2 rows above the formula. The copy of the formula, in cell C6, also looks for values 4, 3, and 2 rows above-in the range C2:C4.

As another example, suppose the International Widget Company decided to include the sales of widget accessories in the January monthly total. A new row is inserted below row 4 (which contains the monthly values for Widget 3). This moves the row containing the formula down one row, to B7.

In the new row, total sales are entered for the widget accessories. As soon as a value is entered into cell B5, Excel changes the formula in cell B7 (formerly B6) from =SUM(B2:B4) to =SUM(B2:B5), and updates the resulting value: In contrast, absolute cell references are references that refer to a specific location. These are indicated by a dollar sign (\$) preceding the part of the reference that should be absolute-that is, before the row reference, before the column reference, or before each, to make the entire cell reference absolute:

· \$B4 indicates that column B is absolute, but row 4 is relative.

· B\$4 indicates that column B is relative, but row 4 is absolute.

· \$B\$4 indicates that the entire reference-to cell B4-is absolute.

When you use an absolute reference, Excel will not adjust formulas when they’re copied to new locations.

Note:

If you include in your formula a range that uses absolute cell references (for example, =SUM(\$B\$2:\$B\$4)) and then insert a row or column that produces a new cell located within that range (for example, you insert a new row before row 4), Excel will adjust the range in the formula, just as it would if you’d used relative references. This is because Excel assumes that you still want your calculation to include the first and last cells you initially specified. However, if you insert a new below row 4 (as we did when we added Widget Accessories), Excel will not adjust the range in the formula, and cell B5 (newly inserted) will not be included in the calculation.

Absolute references should be used when you want to use the same calculated value in different locations in a workbook (for example, if you want to include total annual sales, calculated on the first sheet of a workbook, in subsequent worksheets). Tip:

To quickly change a cell reference from relative to absolute (or vice versa), select the cell and press F4 on your keyboard. This toggles the references through the various combinations of absolute and relative columns and rows.

#### One Comment

1. 