Excel 2007 Formulas (Mr. Spreadsheets Bookshelf)
Excel's Auditing Tools
Excel includes a number of tools that can help you track down formula errors. The following sections describe the auditing tools built into Excel.
Identifying Cells of a Particular Type
The Go To Special dialog box is a handy tool that enables you to locate cells of a particular type. To display this dialog box, choose Home
Note | If you select a multicell range before displaying the Go To Special dialog box, the command operates only within the selected cells. If a single cell is selected, the command operates on the entire worksheet. |
You can use the Go To Special dialog box to select cells of a certain type, which can often help you identify errors. For example, if you choose the Formulas option, Excel selects all the cells that contain a formula. If you zoom the worksheet out to a small size, you can get a good idea of the worksheet's organization (see Figure 21-7).
Tip | Selecting the formula cells may also help you to spot a common error-a formula that has been replaced accidentally with a value. If you find a cell that's not selected amid a group of selected formula cells, chances are good that the cell previously contained a formula that has been replaced by a value. |
Viewing Formulas
You can become familiar with an unfamiliar workbook by displaying the formulas rather than the results of the formulas. To toggle the display of formulas, choose Formulas
Tip | You can also use Ctrl+` (the accent grave key, usually located above the Tab key) to toggle between Formula view and Normal view. |
Figure 21-8 shows an example of a worksheet displayed in two windows. The window on the top shows Normal view (formula results), and the window on the bottom displays the formulas. The View
Several third-party auditing tools for Excel are available, including my Power Utility Pak. If you're interested in finding out about such tools, try searching the Web.
When Formula view is in effect, Excel highlights the cells that are used by the formula in the active cell. In Figure 21-7, for example, the active cell is C11. The cells used by this formula are highlighted in both windows.
Tracing Cell Relationships
To understand how to trace cell relationships, you need to familiarize yourself with the following two concepts:
-
Cell precedents: Applicable only to cells that contain a formula, a formula cell's precedents are all the cells that contribute to the formula's result. A direct precedent is a cell that you use directly in the formula. An indirect precedent is a cell that is not used directly in the formula but is instead used by a cell that you refer to in the formula.
-
Cell dependents: These are formula cells that depend on a particular cell. A cell's dependents consist of all formula cells that use the cell. Again, the formula cell can be a direct dependent or an indirect dependent.
Identifying cell precedents for a formula cell often sheds light on why the formula is not working correctly. Conversely, knowing which formula cells depend on a particular cell is also helpful. For example, if you're about to delete a formula, you may want to check whether it has any dependents.
IDENTIFYING PRECEDENTS
You can identify cells used by a formula in the active cell in a number of ways:
-
Press F2. The cells that are used directly by the formula are outlined in color, and the color corresponds to the cell reference in the formula. This technique is limited to identifying cells on the same sheet as the formula.
-
Display the Go To Special dialog box (choose Home
Editing Find & Select Go To Special). Select the Precedents option and then select either Direct Only (for direct precedents only) or All Levels (for direct and indirect precedents). Click OK, and Excel selects the precedent cells for the formula. This technique is limited to identifying cells on the same sheet as the formula. -
Press Ctrl+[ to select all direct precedent cells on the active sheet.
-
Press Ctrl+Shift+{ to select all precedent cells (direct and indirect) on the active sheet.
-
Choose Formulas
Formula Auditing Trace Precedents. Excel will draw arrows to indicate the cell's precedents. Click this button multiple times to see additional levels of precedents. Choose Formulas Formula Auditing Remove Arrows to hide the arrows. Figure 21-9 shows a worksheet with precedent arrows drawn to indicate the precedents for the formula in cell C13.
IDENTIFYING DEPENDENTS
You can identify formula cells that use a particular cell in a number of ways:
-
Display the Go To Special dialog box. Select the Dependents option and then select either Direct Only (for direct dependents only) or All Levels (for direct and indirect dependents). Click OK. Excel selects the cells that depend on the active cell. This technique is limited to identifying cells on the active sheet only.
-
Press Ctrl+] to select all direct dependent cells on the active sheet.
-
Press Ctrl+Shift+] to select all dependent cells (direct and indirect) on the active sheet.
-
Choose Formulas
Formula Auditing Trace Dependents. Excel will draw arrows to indicate the cell's dependents. Click this button multiple times to see additional levels of dependents. Choose Formulas Formula Auditing Remove Arrows to hide the arrows.
Tracing Error Values
If a formula displays an error value, Excel can help you identify the cell that is causing that error value. An error in one cell is often the result of an error in a precedent cell. Activate a cell that contains an error value and choose Formulas
Fixing Circular Reference Errors
If you accidentally create a circular reference formula, Excel displays a warning message, displays Circular Reference (with the cell address) in the status bar, and draws arrows on the worksheet to help you identify the problem. If you can't figure out the source of the problem, use Formulas
Using Background Error Checking
Some people may find it helpful to take advantage of Excel's automatic error-checking feature. This feature is enabled or disabled by using the check box labeled Enable Background Error Checking, in the Formulas tab in the Excel Options dialog box shown in Figure 21-10. In addition, you can specify which types of errors to check for by using the check boxes in the Error Checking Rules section.
When error checking is turned on, Excel continually evaluates your worksheet, including its formulas. If a potential error is identified, Excel places a small triangle in the upper-left corner of the cell. When the cell is activated, a Smart Tag appears. Clicking this Smart Tag provides you with options. Figure 21-11 shows the options that appear when you click the Smart Tag in a cell that contains a #DIV/0! error. The options vary, depending on the type of error.
In many cases, you will choose to ignore an error by selecting the Ignore Error option. Selecting this option eliminates the cell from subsequent error checks. However, all previously ignored errors can be reset so that they appear again. (Use the Reset Ignored Errors button in the Formulas tab of the Excel Options dialog box.)
You can choose Formulas
Caution | It's important to understand that the error-checking feature is not perfect. In fact, it's not even close to perfect. In other words, you can't assume that you have an error-free worksheet simply because Excel does not identify any potential errors! Also, be aware that this error checking feature won't catch a very common type of error-that of overwriting a formula cell with a value. |
Using Excel's Formula Evaluator
Excel's Formula Evaluator enables you to see the various parts of a nested formula evaluated in the order that the formula is calculated.
To use the Formula Evaluator, select the cell that contains the formula and choose Formula
Click the Evaluate button to show the result of calculating the expressions within the formula. Each click of the button performs another calculation. This feature may seem a bit complicated at first, but if you spend some time working with it, you'll understand how it works and see the value.
Excel provides another way to evaluate a part of a formula:
-
Select the cell that contains the formula.
-
Press F2 to get into cell edit mode.
-
Use your mouse to highlight the portion of the formula that you want to evaluate. Or, press Shift and use the arrow keys.
-
Press F9.
The highlighted portion of the formula displays the calculated result. You can evaluate other parts of the formula or press Esc to cancel and return your formula to its previous state.
Caution | Be careful when using this technique because if you press Enter (rather than Esc), the formula will be modified to use the calculated values. |
Категории