The previous sections explained how to enter a formula once, using relative cell referencing, and copy that formula to other cells . Although you only have to type the formula one time, this kind of totaling formula is tedious to type and introduces greater chance for error:
Fortunately, Microsoft includes several built-in functions that perform many common mathematical calculations. Instead of writing a formula to sum a row or column of values, for example, use the Sum() function.
Function names always end with parentheses, such as Average() . A function accepts zero or more arguments , and an argument is a value that appears inside the parentheses that the function uses in some way. Always separate function arguments with commas. If a function contains only a single argument, you do not use a comma inside the parentheses. Functions generally manipulate data ( numbers or text), and the arguments inside the parentheses supply the data to the function. The Average() function, for example, computes an average of whatever list of values you pass in the argument. Therefore, all the following compute an average from the argument list:
=Average(18, 65, 299, $R, 10, -2, 102) =Average(SalesTotals) =Average(D4:D14)
As with many functions, Average() accepts as many arguments as needed to do its job. The first Average() function computes the average of seven values, one of which is an absolute cell reference. The second Average() function computes the average of a range named SalesTotals . No matter how many cells compose the range SalesTotals , Average() computes the average. The last Average() function computes the average of the values in the range D4 through D14 (a columnar list).
The following formula computes the average of seven arguments, one of which ( F14 ) is a cell reference and one of which ( $R$5 ) is an absolute cell reference:
=Average(18, F14, 299, $R, 10, -2, 102)
The Sum() function is perhaps the most common function because you so often total columns and rows. In the preceding section, you entered a long formula to add the values in a column. Instead of adding each cell to total the range B6:B17, you could more easily enter the following function:
If you copy this Sum() function to the other cells at the bottom of the yearly projections, the total appears at the bottom of those columns.
To Do: Use AutoSum for Efficiency
Before looking at a table of common functions that you can use in your worksheets, consider that one of the activities you'll do the most is adding numbers in formulas. You'll need to add to compute totals, count items, and compute days between activities. Excel helps you add values by analyzing ranges that you select and automatically inserting a Sum() function if needed, thus computing the total. Here's how to do that:
After Excel generates the Sum() function, you can copy the cell down the rest of the column to add the monthly totals. However, can you see another way to perform the same monthly totals with one selection? Select the entire set of monthly values with one extra blank column at the right (the range B6:G17). Excel sees the blank column and fills it in with each row's sum when you click AutoSum. You now can select the new column of totals and let AutoSum compute them. Figure 7.8 shows the result of the new sums after you add underlines and a title to the row.
Figure 7.8. AutoSum in action.
Functions improve your accuracy. If you want to average three cell values, for example, you might type something such as
=C2 + C4 + C6 / 3
This formula does not compute an average! Remember that the operator hierarchy forces the division calculation first. If you use the Average() function, as shown next , you don't have to worry as much about the calculation's hierarchy.
=Average(C2, C4, C6)
Table 7.2 describes common Excel built-in functions that you find a lot of uses for as you create worksheets. Remember to start every formula with an equal sign and to add your arguments to the parentheses, and you are set!
Table 7.2. Common Excel Functions
Some of the functions require more arguments than a simple cell or range. Excel contains many financial functions, for example, that compute loan values and investment rates of return. If you want to use one of the more advanced functions, click on an empty cell and select Insert, Function or click the Insert Function button to display the Insert Function dialog box, as shown in Figure 7.9.
Figure 7.9. Let Excel help you enter complex functions.
You can select from a category of functions in the drop-down list box or describe what you want to do at the top of the dialog box and let Excel locate a function that might work. When you decide on a function (you can simply scroll the list of function names at the bottom of the dialog box and select one), Excel displays an additional dialog box with text box areas for each of the function arguments, such as the one shown in Figure 7.10. As you continue entering arguments that the function requires, Excel builds the function in the cell for you. As you get more proficient, you no longer need the help of the Insert Function dialog box as often.
Figure 7.10. You can quickly enter arguments in the Function Arguments dialog box.