Название: Excel Formulas and Functions For Dummies
Автор: Bluttman Ken
Издательство: Автор
Жанр: Зарубежная образовательная литература
Серия: For Dummies
isbn: 9781119076797
isbn:
2. Click another cell where you want the result to appear.
3. Type =SUM( to start the function.
4. Click the first cell that has an entered value, hold the left mouse button down, and drag the mouse pointer over all the cells that have values.
5. Release the mouse button.
The range address appears where the formula and function are being entered.
6. Type ).
7. Press Enter.
8. Give yourself a pat on the back.
Excel is dynamic when it comes to cell addresses. If you have a cell with a formula that references a different cell’s address, and you copy the formula from the first cell to another cell, the address of the reference inside the formula changes. Excel updates the reference inside the formula to match the number of rows and/or columns that separate the original cell (where the formula is being copied from) from the new cell (where the formula is being copied to). This may be confusing, so try an example so you can see this for yourself:
1. In cell B2, type 100.
2. In cell C2, type =B2 * 2.
3. Press Enter.
Cell C2 now returns the value 200.
4. If C2 is not the active cell, click it once.
5. Press Ctrl + C, or click the Copy button in the Clipboard category on the Home Ribbon.
6. Click cell C3.
7. Press Ctrl + V, or click the Paste button in the Clipboard category on the Home Ribbon.
8. If you see a strange moving line around cell C2, press the Esc key.
Cell C3 should be the active cell, but if it is not, just click it once. Look at the Formula Bar. The contents of cell C3 are =B3 * 2, and not the =B2 * 2 that you copied.
What happened? Excel, in its wisdom, assumed that if a formula in cell C2 references the cell B2 – one cell to the left – the same formula put into cell C3 is supposed to reference cell B3 – also one cell to the left.
When you’re copying formulas in Excel, relative addressing is usually what you want. That’s why it is the default behavior. Sometimes you do not want relative addressing, but absolute addressing. This is making a cell reference fixed to an absolute cell address so that it does not change when the formula is copied.
In an absolute cell reference, a dollar sign ($) precedes both the column letter and the row number. You can also have a mixed reference in which the column is absolute and the row is relative, or vice versa. To create a mixed reference, you use the dollar sign in front of just the column letter or row number. Here are some examples:
As long as I’m on the subject of copying formulas around, take a look at the fill handle. You’re gonna love this one! The fill handle is a quick way to copy the contents of a cell to other cells with just a single click and drag.
The active cell always has a little square box in the lower-right side of its border. That is the fill handle. When you move the mouse pointer over the fill handle, the mouse pointer changes shape. If you click and hold the mouse button, you can drag up, down, or across over other cells. When you let go of the mouse button, the contents of the active cell automatically copy to the cells you dragged over.
A picture is worth a thousand words, so take a look at Figure 1-17, which shows a worksheet that adds some numbers. Cell E4 has this formula: =B4 + C4 + D4. This formula needs to be placed in cells E5 through E15. Look closely at cell E4. The mouse pointer is over the fill handle, and it has changed to what looks like a small, black plus sign. I am about to use the fill handle to drag that formula to the other cells. Clicking and holding the left mouse button down and then dragging down to E15 does the trick.
Figure 1-17: Getting ready to drag the formula down.
Figure 1-18 shows what the worksheet looks like after the fill handle is used to get the formula into all the cells. This is a real time saver. Also, you can see that the formula in each cell of column E correctly references the cells to its left. This is the intention of using relative referencing. For example, the formula in cell E15 ended up with this formula: =B15 + C15 + D15.
Figure 1-18: Populating cells with a formula by using the fill handle.
There’s a saying in the computer business: Garbage in, garbage out. And that applies to how formulas are put together. If a formula is constructed the wrong way, it returns an incorrect result or an error.
Two types of errors can occur in formulas. In one type, Excel can calculate the formula, but the result is wrong. In the other type, Excel is not able to calculate the formula. Check out both of these.
A formula can work and still produce an incorrect result. Excel does not report an error because there is no error for it to find. Often, this is the result of not using parentheses properly in the formula. Take a look at some examples:
All of these are valid formulas, but the placement of parentheses makes a difference in the outcome. You must take into account the order of mathematical operators when writing formulas. Here's the order of precedence:
1. Parentheses
2. Exponents
3. Multiplication and division
4. Addition and subtraction
This is a key point of formulas. It is easy to just accept a returned answer. After all, Excel is so smart. Right? Wrong! Like all computer programs, Excel can do only what it is told. If you tell it to calculate an incorrect but structurally valid formula, it will do so. So watch your p’s and q’s – er, your parentheses and mathematical operators – when building formulas.
The second type of error occurs when a mistake in the formula or in the data the formula uses prevents Excel from calculating the result. Excel makes your life easier by telling you when such an error occurs. To be precise, it does one of the following:
✔ СКАЧАТЬ