Sub topic 7
Finding the source of an error with Trace Error
This chapter assumes you can read basic Excel formulas, tell absolute references from relative ones, and recognize a three-statement model layout. It also assumes you have already met the main error values and the Trace Precedents arrows from earlier chapters. Here you will use Trace Error to find where an error starts, rather than where it shows up.
Why errors appear far from their cause
In a financial model, one bad cell rarely stays alone. An error value is an input to every formula that refers to it, so the error spreads along the calculation chain. A single #DIV/0! in a revenue growth row can turn the income statement, the cash flow statement, the balance sheet, and the valuation output into errors.
When you open such a model, the cell you notice first is usually the output, such as the share price or the ending cash balance. That cell is a victim. The cell you need is the origin: the first cell in the chain that produced the error from valid inputs.
Trace Error automates the search for that origin. It draws red arrows from an error cell back toward the cells that feed it and are also in error.
Where to find Trace Error
- Select a cell that displays an error value.
- Go to the Formulas tab.
- In the Formula Auditing group, open the Error Checking drop-down.
- Choose Trace Error.
The Trace Error command is only available when the active cell contains an error. If the cell holds a normal value, the command is greyed out.
You can also click the small yellow warning icon that appears next to an error cell. Its menu has the same Trace Error option, plus Show Calculation Steps, which opens Evaluate Formula.
What the arrows mean
Trace Error draws two kinds of arrows.
- Red arrows point from cells that also contain errors into the selected cell. These are the error's precedents that are themselves broken.
- Blue arrows point from cells that hold valid values into the selected cell. They show the other inputs of the formula, so you can see what the formula was fed.
A tracer arrow that ends in a small worksheet icon means the precedent is on another sheet. Double-click the arrow to open the Go To list of its sources and jump to one.
The rule is: follow the red arrows. A cell that has no red arrow pointing into it, but is itself in error, is a candidate origin. Its inputs are valid, so the error was created by that cell's own formula.
A worked example
Suppose a model has these cells on a sheet named Inputs and IS.
| Cell | Content | Result |
|---|---|---|
| `Inputs!C12` | Prior-year units sold (typed value) | 0 |
| `Inputs!D12` | `=D11/C12` | `#DIV/0!` |
| `IS!D6` | `=IS!C6*(1+Inputs!D12)` | `#DIV/0!` |
| `IS!D20` | `=IS!D6-IS!D7` | `#DIV/0!` |
| `CF!D30` | `=IS!D20+CF!D25` | `#DIV/0!` |
The balance sheet check cell shows #DIV/0! too, which is what first draws your attention. To find the source:
- Select the check cell and run Trace Error. A red arrow points to the ending cash cell on the balance sheet.
- Select that ending cash cell and run Trace Error again. A red arrow points to
CF!D30. - Repeat for
CF!D30, thenIS!D20, thenIS!D6. Each step moves one link back. - Select
Inputs!D12. Run Trace Error once more. No red arrow appears, only a blue arrow fromD11. The command still listsC12as a precedent when you use Trace Precedents, and its value is 0.
Inputs!D12 is the origin. Its formula divides by C12, and C12 is zero. The cause is a data issue: a product with no units in the prior year. The fix depends on the model's intent, not on the arrows.
Tracing in one pass
Each press of Trace Error moves back one level. You do not have to select each cell by hand. After the first red arrows appear, double-click a red arrow to jump to the cell at its far end, then run Trace Error again from there. This keeps you in the chain and works across sheets.
To clear the arrows when you are done, use Remove Arrows in the same Formula Auditing group.
Errors that have more than one origin
A cell can have several error precedents. For example, a formula that adds a #REF! cell and a #DIV/0! cell shows two red arrows. Trace Error does not tell you which one Excel reported. Excel returns the error that comes first in its internal evaluation, so the visible error may be only one of several problems.
Treat each red arrow as a separate branch and follow them all. Fix one origin, recalculate, and check whether the error disappears or changes type. A change from #DIV/0! to #REF! means another origin remains.
Reading the origin cell
Once you reach a cell with no red arrows, ask what in that cell created the error. The cause is usually one of these.
| Error | Common origin in a model |
|---|---|
| `#DIV/0!` | A denominator that is zero or blank, such as a prior-period value in a growth rate |
| `#REF!` | A deleted row, column, or sheet that a formula pointed to |
| `#N/A` | A lookup that finds no match, or a deliberate `NA()` placed by the modeler |
| `#VALUE!` | Text where a number is needed, such as a number stored as text |
| `#NAME?` | A misspelled function or a named range that no longer exists |
| `#NUM!` | An invalid numeric operation, or an IRR that cannot converge |
| `#NULL!` | A space typed between two references where a comma or colon belongs |
When the origin formula looks fine, use Evaluate Formula on that cell. It steps through the calculation and shows the sub-expression that fails.
Deliberate errors make tracing easier
Wrapping a division in IFERROR with a zero fallback hides the origin and lets bad numbers flow through the model. A better pattern is to let the problem surface in a way you can trace.
=IF(C12=0, NA(), D12/C12)This returns #N/A when the denominator is zero. The error still propagates, so Trace Error can follow it, and the origin cell carries a formula that states its own condition. Use this where a zero denominator is a real data problem. Where a zero denominator is expected, such as a growth rate on a new product, decide the intended value explicitly and document it.
What Trace Error cannot do
Trace Error depends on the same dependency data as Trace Precedents, so it has the same blind spots.
- Closed external workbooks. If a precedent is in another workbook that is not open, the arrow stops at the link. Open the source workbook and trace again.
- INDIRECT and OFFSET. These functions build references at calculation time. Excel cannot draw arrows to cells it only determines when the formula runs. Use Evaluate Formula to see what the function returns.
- Names that resolve to ranges. Arrows may point to a whole range rather than to the one cell inside it that holds the error. Look inside the range for the bad cell.
- Very large ranges. An error somewhere in
SUM(C5:N80)shows a red arrow to the range, not to the exact cell. Use Go To Special (Constants, Formulas, Errors) to select every error cell in the range at once. - Stale results. If calculation is set to manual, displayed errors may not match the current formulas. Press
F9before you trace.
Go To Special is the quickest way to list every error. Press F5, choose Special, select Formulas, tick only Errors, and click OK. Excel selects all cells in the sheet that contain an error value. Then press Enter repeatedly to step through the selection, or look for the one that sits earliest in the calculation order.
A count of errors belongs in the model itself, so the problem is visible without any tracing:
=SUMPRODUCT(--ISERROR(C5:N80))A nonzero result tells you at once that something needs tracing. The check chapter later in this tutorial shows how to combine it with other checks.
Common mistakes
- Fixing the victim. Wrapping an output cell in
IFERRORremoves the visible error without touching the origin. The model then reports a wrong number with no warning. - Stopping at the first red arrow. An error often has several origins. Follow every branch.
- Tracing a stale state. Trace after a full recalculation, with iterative calculation turned off unless the model needs it.
- Confusing a circular reference with an error. A circular reference warning is not an error value. Trace Error will not help with it, and a later chapter covers it separately.
- Deleting the origin's input. If the cause is a zero in an input, check whether the input is actually wrong before you change a formula.
A short procedure
- Press
F9to force a full calculation. - Select an output cell in error and run Trace Error.
- Follow the red arrows back one level at a time, across sheets when needed.
- Stop at a cell with error type but no red arrows. That is an origin.
- Identify the cause with the error type table and Evaluate Formula.
- Fix the origin, not the downstream cells.
- Recalculate and check whether the outputs recover or show a different error. If they do, repeat from step 2.
- Log the finding.
Exercise
In a model, the cell Balance!F40 shows #REF!. You run Trace Error on it and see one red arrow to CF!F22. CF!F22 has two red arrows, one to IS!F15 and one to Debt!F8. IS!F15 has no red arrows, and its formula is =IS!F9+#REF!. Debt!F8 has no red arrows and its formula is =Debt!F5/Debt!E5, showing #DIV/0!. How many origins are there, what causes each, and why should you not just wrap CF!F22 in IFERROR?
Show answer
There are two origins: IS!F15 and Debt!F8. IS!F15 contains a literal #REF! inside its formula, so a row, column, or sheet it referred to was deleted, and the reference must be rebuilt. Debt!F8 divides by Debt!E5, which is zero or blank, so you need to check why the prior-period balance is empty and handle that case explicitly, for example with a NA() test. Wrapping CF!F22 in IFERROR would hide both problems and let a wrong cash flow figure reach the balance sheet with no warning. The balance sheet would then likely fail its own check, or worse, appear to balance with wrong numbers.
Exercise
Why can Trace Error fail to reach the origin when a formula uses INDIRECT, and what can you do instead?
Show answer
INDIRECT builds its reference from text when the formula calculates, so Excel has no fixed dependency to draw an arrow to. Use Evaluate Formula on the cell to see which address INDIRECT returns, then select that cell and trace from there. Also consider replacing INDIRECT with a direct reference or INDEX where the model allows it, so that tracing works.