Sub topic 5
Stepping through a formula with Evaluate Formula
Trace Precedents shows which cells feed a formula. It doesn't show what happens inside the formula. Evaluate Formula covers that gap. It computes a formula one operation at a time and shows each intermediate result, so you can find the exact step where a value goes wrong.
This chapter assumes you can read nested formulas (IF, INDEX, MATCH, SUMPRODUCT) and know the difference between relative and absolute references. It also assumes you have used Trace Precedents and Trace Error from the earlier chapters.
What Evaluate Formula does
Evaluate Formula is on the Formulas tab, in the Formula Auditing group. It opens a dialog for the active cell. The dialog has these parts:
- Reference shows the cell and sheet being evaluated.
- Evaluation shows the formula with one part underlined. The underlined part is what the next click calculates.
- Evaluate replaces the underlined part with its result. Results appear in italics.
- Step In opens the formula of a referenced cell, so you can evaluate that cell's formula in a second pane. It is available only when the underlined part is a reference to a cell that contains a formula.
- Step Out returns to the formula you came from.
- Restart goes back to the unevaluated formula.
You can evaluate only one cell at a time. The cell must contain a formula, and you can't edit anything while the dialog is open.
The evaluation order
Excel evaluates in its normal order of operations. It works on the innermost parts first, then moves outward. Within the same precedence level, it goes left to right. The underline follows that order, so the dialog also shows how Excel parses your formula. If a result surprises you, the cause is often a precedence mistake. For example, -A1^2 is (-A1)^2 in Excel, which gives a positive number.
A worked example
Suppose a model prices revenue from a lookup table. Cell E20 holds this formula:
=INDEX(Price_Table, MATCH(E$4, Years, 0)) * E10Price_Table is a named range of unit prices, and Years is a named range of the years in the table's header. Cell E4 holds the forecast year. E20 shows #N/A.
Trace Precedents would show arrows to E4, E10, and the two named ranges. All of them look fine. Evaluate Formula narrows the problem down in these steps:
- Select
E20and open Evaluate Formula. - The underline starts on
Price_Table. Click Evaluate. It becomes the array of prices. - The underline moves to
E$4. Click Evaluate. It becomes"2027", in quotation marks. - The underline moves to
Years. Click Evaluate. It becomes{2025,2026,2027,2028}, with no quotation marks. - Click Evaluate on the
MATCHcall. The result is#N/A.
The quotation marks in step 3 are the finding. E4 holds the year as text, and the header row holds real numbers. MATCH with match type 0 doesn't treat "2027" and 2027 as equal, so it finds nothing. The root cause is a number stored as text. Excel's error-checking rules flag this with a green triangle, but the triangle is easy to miss in a large model.
Evaluate Formula didn't find the problem by itself. It showed you every intermediate value. You found the problem by comparing the value that went into MATCH with the value the lookup range holds.
Using Step In across the calculation chain
Step In connects Evaluate Formula to the dependency chain. Say E20 refers to E10, and E10 is =E8*E9. When the underline is on E10, Step In shows the formula of E10 in a second pane. You evaluate E10 there, then click Step Out to continue with E20. This is a precedent trace without leaving the dialog.
Step In has these limits:
- It is not available for a reference to a cell in a different workbook.
- It is not available when a cell reference appears a second time in the same formula.
- It does nothing for a reference to a cell that holds a constant. You see the value directly when you click Evaluate.
Use Step In when the value of a precedent is wrong and you need to know why. If the precedent is a typed number, Step In is not needed. Click the cell and check whether it should be a formula, as covered in the hardcode chapter.
Reading the results carefully
Evaluate shows only the branch Excel takes
For IF, IFS, CHOOSE, and SWITCH, Excel evaluates only the branch it needs. If E20 is =IF(C12=0, NA(), D12/C12), Evaluate Formula shows the condition, then only one of the two outcomes. To test the branch that wasn't taken, change the input temporarily, or copy the formula to a scratch cell. Don't change model inputs without noting the original values.
Names and ranges
A named range is replaced by its contents when you evaluate it. A multi-cell range appears as an array in curly braces. Long arrays are truncated in the display, so for a big range, select the range in the worksheet instead.
Volatile functions can disagree with the cell
OFFSET, INDIRECT, TODAY, NOW, RAND, CELL, and INFO are volatile functions. They recalculate whenever Excel recalculates. Evaluate Formula recalculates them as it steps, so the dialog's final result can differ from the value in the cell. If the two don't match, a volatile function is the first thing to suspect.
Reading an error from the inside
An error value propagates outward. In =INDEX(...)*E10, the MATCH error becomes the INDEX error, and then the multiplication error. Evaluate Formula shows you the innermost operation that first produced the error. That is the one to fix.
| Observation in the dialog | Likely cause |
|---|---|
| A value in quotation marks where a number is expected | Number stored as text |
| An array where one number is expected | A range used where a single cell was intended |
| `#N/A` from `MATCH` or `VLOOKUP` | Lookup value missing, or text and number mismatch |
| `#DIV/0!` from a division step | A denominator cell is blank or zero |
| `#NAME?` from a name | Name misspelled or deleted |
| Final value differs from the cell | A volatile function or manual calculation mode |
F9: a faster partial check
For quick checks, you can evaluate part of a formula in the formula bar. Click into the formula bar, select a part of the formula that is a complete expression, and press F9. Excel replaces the selection with its value.
Press Esc to cancel the edit and leave the formula as it was. If you press Enter instead, the formula is overwritten with the calculated value, which creates a hardcode. This is a common way for audits to damage a model.
F9 is faster for one-off checks. Evaluate Formula is safer because it can't change the cell, and it handles the evaluation order for you.
When to use Evaluate Formula in an audit
Evaluate Formula is slow for long formulas, so use it with a purpose:
- After Trace Error has pointed to the cell where an error starts, and the formula is too complex to read.
- When a result is wrong but no error shows. A wrong sign, wrong lookup row, or wrong range can't be found with arrows.
- When a formula was flagged as inconsistent and you need to see what each version computes.
- When you inherit a nested formula with several
IFlevels and want to confirm the logic before you change anything.
Don't use it as the first tool. A balance check or an error count tells you that something is wrong. Trace Precedents tells you where to look. Evaluate Formula tells you why. A very long formula is itself a finding. Record it in your findings log with a suggestion to split it into helper rows.
To keep a record of what you evaluated, put FORMULATEXT in an adjacent cell:
=FORMULATEXT(E20)This shows the formula as text, so you can paste it into your findings log together with the intermediate value that exposed the issue.
Common errors when using the tool
- Evaluating the wrong cell. The dialog follows the active cell when you open it. Check the Reference line before you start.
- Clicking through too fast. Stop at every step where a value is a type you didn't expect, such as text, an array, or a blank.
- Fixing the symptom. Wrapping the formula in
IFERRORhides the failingMATCHinstead of correcting the text year inE4. - Ignoring calculation mode. In manual mode, a precedent may not have recalculated, so the dialog shows a stale value. Press F9 on the sheet first, or check the status bar.
- Trusting the dialog for external links. Step In doesn't cross workbooks, so check the linked file directly.
Exercise
A formula in G15 is =VLOOKUP(G$3, Rates, 2, FALSE) * F15 and shows #N/A. In Evaluate Formula, the underlined G$3 evaluates to "Q1-2027" with quotation marks, and Rates is an array whose first column contains the values Q1-2027, Q2-2027 and so on. What do you check next, and why is wrapping the formula in IFERROR a poor fix?
Show answer
The visible values match, so the cause is probably hidden characters or a type difference, such as a trailing space in G3 or in the Rates key column. Check with LEN or EXACT on the two cells, and clean the source. IFERROR is a poor fix because it would replace the error with a value such as 0, and the revenue or cost would then be wrong without any visible sign.
Exercise
You select part of a long formula in the formula bar, press F9 to see its value, and then press Enter. What happened to the model, and how do you avoid it?
Show answer
Enter replaced the selected part of the formula with its calculated number, so the cell now contains a hardcoded value inside a formula and will no longer update when inputs change. To avoid this, press Esc after F9 to cancel the edit, or use the Evaluate Formula dialog, which can't change the cell.