Excel - Working with Formulas

advertisement
Excel - Working with Formulas
Including calculations in a worksheet gives you valuable answers to questions about your data. To do so,
you create formulas, or expressions, that perform calculations on your data. Formulas can help you
calculate totals, figure averages, or find the highest and lowest data points for a week, month, or year.
To write an Excel formula, you must always begin the cell's contents with an equal sign—when Excel
sees it, it knows that the expression following it should be interpreted as a calculation and not text. After
the equal sign, you type the formula.
Note: If Excel treats your formula as text, make sure you haven't accidentally put a space before the equal
sign. Remember, the equal sign must be the first character!
You can type formulas using conventional mathematical arguments such as +, -, /, or *, but Excel's
functions, or predefined formulas, make it easy to handle complex calculations. The Insert Function
dialog box offers a long list of functions from which to choose. The most commonly used functions are
described in the table below.
Function
Description
SUM
Returns the sum of the numbers in the specified cells.
AVERAGE Finds the average of the numbers in the specified cells.
COUNT
Finds the number of entries in the specified cells.
MAX
Finds the largest value in the specified cells.
MIN
Finds the smallest value in the specified cells.
Another kind of formula, called a conditional formula, performs a given action only when certain
conditions are met. Conditional formulas use the IF function.
Another functions you might use is the NOW() function. The NOW() function returns the time the
workbook was last opened, so the value will change every time the workbook is opened. The proper form
for this function is =NOW() ; to update the value to the current date and time, just save your work, close
the workbook, and then reopen it.
You can also use named ranges in a formula. For example, if the named range Order1 refers to cells C2
through C6, you can calculate the average of the values in cells C2 through C6 with the formula
=AVERAGE(Order1) . If you want to include a series of contiguous cells in a formula but you haven't
defined the cells as a named range, you can click the first cell in the range and drag to the last cell. If the
cells aren't contiguous, hold down the CONTROL key and click the cells to be included. In both cases,
when you release the mouse button, a reference to the selected range of cells appears in the formula.
When you copy and paste a formula into another cell, Excel might adjust some or all of the references in
the formula to conform to the cell in which you have pasted it. For instance, in the following graphic, we
have copied cell D8, which contained the formula =SUM(C2:C6) , into cell D17, and then into cell D18.
The formula in cell D17 has been revised
to =SUM(C10:C14) . The formula in cell
D18 has been revised to
=SUM(C11:C15) . Excel thinks it can
reinterpret the cells used in the formula
because the formula uses a relative
reference, or a reference that changes
when the formula is copied to a new cell.
Relative references are written with just
the cell row and column (for example,
C14 ). In cell D17, the revision is
appropriate because it now calculates a
total based on the prices for Order #2,
just as D8 calculates a total for prices in
Order #1. But in cell D18, the relative
location of these cells is different, so
Excel does not know how to revise the
formula appropriately.
If you want a cell reference to remain constant when the formula using it is copied to another cell, you can
use an absolute reference. To write an absolute reference, you type $ before the column name and before
the row number. So, if you wanted the formula from cell D8 to calculate the sum of C2:C6 regardless of
the cell into which it was pasted, you would write the formula =SUM($C$10:$C$14) .
Note: In order to prevent Excel from changing the cell references when you copy a formula to a new cell,
use any of the following methods:
· Use absolute references.
· Copy the formula from the formula bar.
· Use only named ranges in your formula.
Download