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 Editing Find & Select Go To Special, which displays the Go To Special dialog box, as shown in Figure 21-6.

Figure 21-6: The Go To Special dialog box.

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).

Figure 21-7: Zooming out and selecting all formula cells can give you a good overview of how the worksheet is designed.

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 Formula Auditing Show Formulas. You may want to create a second window for the workbook before issuing this command. This way, you can see the formulas in one window and the results of the formula in the other window. Choose View Window New Window to open a new window.

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 Window View Side by Side command, which allows synchronized scrolling, is also useful for viewing two windows.

Figure 21-8: Displaying formulas (bottom window) and their results (top window).

Third-Party Auditing Tools

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:

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:

Figure 21-9: This worksheet displays lines that indicate cell precedents for the formula in cell C13.

IDENTIFYING DEPENDENTS

You can identify formula cells that use a particular cell in a number of ways:

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 Formula Auditing Error Checking Trace Error. Excel draws arrows to indicate the error source.

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 Formula Auditing Error Checking Circular References. This command displays a list of all cells that are involved in the circular references. Start by selecting the first cell listed and then work your way down the list until you figure out the problem.

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.

Figure 21-10: Excel can check your formulas for potential errors.

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.

Figure 21-11: Clicking an error Smart Tag gives you a list of options.

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 Formula Auditing Error Checking to display a dialog box that describes each potential error cell in sequence, much like using a spell-checking command. This command is available even if you disable background error checking. Figure 21-12 shows the Error Checking dialog box. Note that this dialog box is modeless, so you can still access your worksheet when the Error Checking dialog box is displayed.

Figure 21-12: Using the Error Checking dialog box to cycle through potential errors identified by Excel.

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 Formula Auditing Evaluate Formula to display the Evaluate Formula dialog box, as shown in Figure 21-13.

Figure 21-13: Excel's Formula Evaluator shows a formula being calculated one step at a time.

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:

  1. Select the cell that contains the formula.

  2. Press F2 to get into cell edit mode.

  3. Use your mouse to highlight the portion of the formula that you want to evaluate. Or, press Shift and use the arrow keys.

  4. 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.

Категории