Auditing and Documenting Worksheets

Excel has a number of powerful and flexible features that help you audit and debug your worksheets and document your work. Most of the Excel auditing features appear on the Formulas tab in the Formula Auditing group, which is shown in Figure 8-51.

The Formula Auditing group on the Formulas tab provides access to most of the auditing features.

Figure 8-51. The Formula Auditing group on the Formulas tab provides access to most of the auditing features.

image with no caption

Click the Error Checking button on the Formulas tab to quickly find any error values displayed on the current worksheet and display the Error Checking dialog box, shown in Figure 8-52. The first erroneous cell in the worksheet is selected, and its contents are displayed in the dialog box along with a suggestion about the nature of the problem.

When a problem appears in the dialog box, the following selections are available:

Click the Previous and Next buttons to locate additional errors on the current worksheet. Click the Options button to display the Formulas category in the Excel Options dialog box, shown in Figure 8-53. Select or clear the check boxes in the two Error Checking areas to determine the type of errors to look for and the way they are processed. Click the Reset Ignored Errors button if you want to recheck or if you clicked the Ignore Error button in the Error Checking dialog box by mistake.

image with no caption

Sometimes it’s difficult to tell what’s going on in a complex nested formula. A formula is nested when parts of it (called arguments) can be calculated separately. For example, in the formula =IF(Pay_Num<>“”,Scheduled_Monthly_Payment,“”), the named reference Pay_Num indicates a cell that must contain a value in order for the rest of the formula to function. To make this formula easier to read, you can replace this expression with a constant—in this case, 1 (indicating that the expression is TRUE). The formula would then be =IF(1<>“”,Scheduled_Monthly_Payment,“”).

When you click the Evaluate Formula button on the Formulas tab, you can resolve each nested expression one at a time in complex formulas. Figure 8-54 shows the Evaluate Formula dialog box in action.

Click Evaluate to replace each calculable argument with its resulting value. You can click Evaluate as many times as necessary, depending on how many nested levels exist in the selected formula. For example, if you click Evaluate in Figure 8-54, Excel replaces the aforementioned Pay_Num reference with its value. Clicking Evaluate again calculates the next level, and so on, until you reach the end result, which in this case is $188.71, as shown in Figure 8-55.

Eventually, clicking Evaluate results in the formula’s displayed value, and the Evaluate button changes to Restart, letting you repeat the steps. Click Step In to place each calculable reference into a separate box, making the hierarchy more apparent. In our example, the first evaluated reference is to a cell range, which cannot be further evaluated. If the reference is to a cell containing another formula, its address appears in the Evaluate Formula dialog box, as shown in Figure 8-56. Where there are no more steps to be displayed, click Step Out to close the Step In box and replace the reference with the resulting value.

If you’ve ever looked at a large worksheet and wondered how you could get an idea of the data flow—that is, how the formulas and values relate to one another—you’ll appreciate cell tracers. You can also use cell tracers to help find the source of those pesky errors that occasionally appear in your worksheets. The Formula Auditing group on the Formulas tab contains three buttons that control the cell tracers: Trace Precedents, Trace Dependents, and Remove Arrows.

image with no caption

In the worksheet in Figure 8-59, we selected cell B2, which contains an hourly rate value. To find out which cells contain formulas that use this value, click the Trace Dependents button on the Formulas tab. Although this worksheet is elementary to make it easier to illustrate cell tracers, consider the ramifications of using cell tracers in a large and complex worksheet.

The tracer arrows indicate that cell B2 is directly referred to by the formulas in cells C5, C6, C7, and C8. If you click Trace Dependents again, another set of arrows appears, indicating the next level of dependencies—or indirect dependents. Figure 8-60 shows the results.

One handy feature of the tracer arrows is that you can use them to navigate, which can be advantageous in a large worksheet. For example, in Figure 8-60, with cell B2 still selected, double-click the arrow pointing from cell B2 to cell C8. The selection jumps to the other end of the arrow, and cell C8 becomes the active cell. Now, if you double-click the arrow pointing from cell C8 to cell E8, the selection jumps to cell E8. If you double-click the same arrow again, the selection jumps back to cell C8. If you double-click an arrow that extends beyond the screen, the window shifts to display the cell at the other end. You can use this feature to jump from cell to cell along a path of precedents and dependents.

Suppose your worksheet displays error values like the ones shown in Figure 8-62. To trace one of these errors to its source, select a cell that contains an error, and click Trace Error, located on the Error Checking menu in the Formula Auditing group on the Formulas tab. (Refer to Figure 8-52 on page 262.)

Notice that the cells containing errors display small, green, triangular indicators in their upper-left corners, as shown in Figure 8-62, and when you select one of these cells, a floating Trace Error button appears. Clicking the button displays a menu of applicable actions, including Trace Error, a command you can also find on the menu that appears when you click the arrow to the right of the Error Checking button on the Formulas tab, as shown in Figure 8-63.

When you click Trace Error, Excel selects the cell that contains the first formula in the error chain and draws red arrows from that cell to the cell you selected, as you can see in Figure 8-63. Excel draws blue arrows to the cell that contains the first erroneous formula from the values the formula uses. It’s up to you to determine the reason for the error; Excel takes you to the source formula and shows you the precedents. In our example, the error is caused by a space character inadvertently entered in cell B6, replacing the hours-worked figure. This is a common, vexing problem because cells containing space characters appear to be empty, but a truly empty cell would not have produced an error in this case.

image with no caption

Someday, someone else might need to use your workbooks, so it’s good to be clear and to explain everything thoroughly. You can attach comments to cells to document your work, explain calculations and assumptions, or provide reminders. Select the cell you want to annotate, and click the New Comment button in the Comments group on the Review tab. (The button changes to Edit Comment after you click it.) Then type your message in the box that appears, as shown in Figure 8-65.

When you add a comment to a cell, your name appears in bold type at the top of the comment box. You can specify what appears here by clicking the File tab, Options, and in the Personalize category typing your name (or any other text) in the User Name box. Whatever you type here appears at the top of the comment box followed by a colon. Although you can attach only one comment to a cell, you can make your comment as long as you like. If you want to begin a new paragraph in the comment box, press Enter. When you’ve finished, you can drag the handles to resize the comment box.