Perform calculations on data

  • 3/15/2022

Find and correct errors in calculations

Including calculations in a worksheet gives you valuable answers to questions about your data. As is always true, however, it’s possible for errors to creep into your formulas. With Excel, you can find the source of errors in your formulas by identifying the cells used in a specific calculation and describing any errors that have occurred. The process of examining a worksheet for errors is referred to as auditing.

Excel identifies errors in several ways. The first way is to display an error code in the cell that contains the formula generating the error.

03fig17.jpg

A warning triangle and pound sign indicate an error

When the active cell generates an error, Excel displays an Error button next to it. Pointing to the button displays information about the error, and selecting the button displays a menu of options for handling the error.

The following table explains the most common error codes.

Error code

Description

#####

The column isn’t wide enough to display the value.

#VALUE!

The formula has the wrong type of argument, such as text in a cell where a numerical value is required.

#NAME?

The formula contains text that Excel doesn’t recognize, such as an unknown named range.

#REF!

The formula refers to a cell that doesn’t exist, which can happen whenever cells are deleted.

#DIV/0!

The formula attempts to divide by zero.

Another technique you can use to find the source of formula errors is to ensure that the appropriate cells are providing values for the formula. You can identify the source of an error by having Excel trace a cell’s precedents, which are the cells with values used in the active cell’s formula. You can also audit your worksheet by identifying cells with formulas that use a value from a particular cell. Cells that use another cell’s value in their calculations are known as dependents, meaning that they depend on the value in the other cell to derive their own value. They are identified in Excel by tracer arrows. If the cells identified by the tracer arrows aren’t the correct cells, you can hide the arrows and correct the formula.

03fig18.jpg

Tracing a cell’s dependents

If you prefer to have the elements of a formula error presented as text in a dialog, you can use the Error Checking tool to locate errors one after the other. You can choose to ignore the selected error or move to the next or the previous error.

03fig19.jpg

Identify and manage errors from the Error Checking window

When you just want to display the results of each step of a formula and don’t need the full power of the Error Checking tool, you can use the Evaluate Formula dialog to move through each element of the formula. The Evaluate Formula dialog is particularly useful for examining formulas that don’t produce an error but aren’t generating the result you expect.

03fig20.jpg

Step through formulas in the Evaluate Formula window

Finally, you can monitor the value in a cell regardless of where you are in your workbook by opening a Watch Window that displays the value in the cell. For example, if one of your formulas uses values from cells in other worksheets or even other workbooks, you can set a watch on the cell that contains the formula, and then change the values in the other cells. As you change the precedent values, the formula result changes in the Watch Window. When you’re done watching the formula, you can delete the watch and close the Watch Window.

03fig21.jpg

Monitor formula results in the Watch Window

To display information about a formula error

  1. Select the cell that contains the error.

  2. Point to the error indicator next to the cell to display information about the error.

  3. Select the error indicator to display options for correcting or learning more about the error.

To identify the cells that a formula references

  1. Select the cell that contains the formula.

  2. On the Formulas tab, in the Formula Auditing group, select Trace Precedents.

To identify formulas that reference a specific cell

  1. Select the cell.

  2. In the Formula Auditing group, select Trace Dependents.

To remove tracer arrows

  • In the Formula Auditing group, do one of the following:

    • To remove all the arrows, select the Remove Arrows button (not its arrow).

    • To remove only precedent or dependent arrows, select the Remove Arrows arrow, and then select Remove Precedent Arrows or Remove Dependent Arrows.

To evaluate a formula one calculation at a time

  1. Select the cell that contains the formula you want to evaluate.

  2. In the Formula Auditing group, select Evaluate Formula.

  3. In the Evaluate Formula dialog, select Evaluate. Excel replaces the underlined calculation with its result.

  4. Do either of the following:

    • Select Step In to move forward by one calculation.

    • Select Step Out to move backward by one calculation.

  5. When you finish, select Close.

To change error display options

  1. Display the Formulas page of the Excel Options dialog.

  2. In the Error Checking section, select or clear the Enable background error checking checkbox.

  3. Select the Indicate errors using this color button and select a color.

  4. Select Reset Ignored Errors to return Excel to its default error indicators.

  5. In the Error checking rules section, select or clear the checkboxes next to errors you want to indicate or ignore, respectively.

To watch the values in a cell range

  1. Select the cell range you want to watch.

  2. In the Formula Auditing group, select the Watch Window button.

  3. In the Watch Window dialog, select Add Watch.

  4. In the Add Watch dialog, confirm the cell range, and then select Add.

To delete a watch

  1. Select the Watch Window button.

  2. In the Watch Window dialog, select the watch you want to delete.

  3. Select Delete Watch.