Sub topic 8
Auditing formulas from the keyboard
This chapter shows how to trace, test, and review the formulas in a model without the mouse. It assumes you know relative and absolute references, can read the color-coding convention from earlier in this tutorial (blue inputs, black formulas, green links), and know that Ctrl+` toggles Show Formulas.
Why audit from the keyboard
Most model errors fall into three groups: a hardcoded number typed over a formula, a formula that breaks the pattern of its row, and a link to the wrong cell. Finding them by clicking through cells is slow and misses things. The keyboard tools below let you ask the workbook direct questions, such as "which cells feed this one?" and "which cells in this block are not formulas?"
The tools fall into three groups:
- Tracing: Ctrl+[ and Ctrl+] move along the dependency chain.
- Selecting by cell type: Go To Special selects every cell of a given kind in one step.
- Inspecting: Evaluate Formula and the Watch Window show the calculation as it runs.
Tracing precedents and dependents
A precedent is a cell that a formula reads. A dependent is a cell that reads the active cell. Excel can select either set.
| Shortcut | What it does |
|---|---|
| Ctrl+[ | Selects direct precedents and jumps to them |
| Ctrl+Shift+{ | Selects all precedents, direct and indirect |
| Ctrl+] | Selects direct dependents and jumps to them |
| Ctrl+Shift+} | Selects all dependents, direct and indirect |
| Alt+M, P | Draws trace-precedent arrows |
| Alt+M, D | Draws trace-dependent arrows |
| Alt+M, A, A | Removes all arrows |
| F2 | Edit mode: colored borders mark each referenced range |
If the precedent is on another worksheet, Ctrl+[ takes you to that sheet. You can then move on to its precedents or return with Ctrl+Z. Ctrl+Shift+{ and Ctrl+Shift+} are meant for a single sheet. Do not rely on them to follow a chain across sheets.
To audit one number, start on the result, for example net income. Press Ctrl+[ to see its direct inputs, step into one of them, and repeat. This is a backward trace. A forward trace with Ctrl+] answers "what breaks if I change this input?" Run it on every key assumption before you change it.
Go To Special
Press Ctrl+G, then Alt+S, to open Go To Special. (F5 opens the same Go To dialog.) Select a range first and the command acts only inside it. With a single cell selected, it acts on the whole sheet. Choose an option by pressing its underlined letter.
| Option | Letter | Audit use |
|---|---|---|
| Constants | O | Find typed numbers sitting in a forecast area |
| Formulas | F | Select every formula, optionally filtered by result type |
| Blanks | K | Find gaps in a timeline or schedule |
| Row differences | W | Find cells whose formula differs from the first cell in the row |
| Column differences | M | The same test down columns |
| Precedents / Dependents | P / D | Select them for the current selection, including all levels if you choose that option |
| Last cell | S | Find where the used range really ends |
| Visible cells only | Y | Copy filtered or grouped rows without hidden ones |
The shortcuts Ctrl+\ (row differences) and Ctrl+Shift+| (column differences) skip the dialog.
Finding hardcodes
- Select the forecast block, for example
D10:O60. - Press Ctrl+G, Alt+S, then O for Constants, and press Enter.
- Every typed number and text label in the block is now selected. Any numeric constant that is not a header or a deliberate input is a suspect.
- Apply a bright fill with Alt+H, H to mark the cells you need to review, then clear the fill afterward.
In the Constants dialog you can untick Text, Logicals, and Errors so that only numbers remain. The Formulas option has the same checkboxes. Use Formulas with only Errors ticked to find every #REF! or #DIV/0! at once.
Finding broken patterns
A forecast row should hold one formula copied across. Select the row from its first forecast cell to its last, press Ctrl+\, and look at what is selected. Excel compares each cell with the active cell using R1C1 logic, so a correctly copied formula does not count as different. Anything selected is a cell whose formula is structured differently, such as a hardcode, a changed reference, or a different function. Check each one. Some will be intentional, such as a first-period opening balance.
Evaluate Formula and the Watch Window
Alt+M, V opens Evaluate Formula. Each press of Evaluate (Alt+E) calculates the underlined part of the formula and shows its value. Step In (Alt+I) enters a nested reference. Use this for long nested IF or INDEX/MATCH formulas where you cannot see which part misbehaves.
Alt+M, W opens the Watch Window. Add key cells to it, such as the balance check, ending cash, and net debt. The window floats over every sheet and shows their values as you edit assumptions elsewhere. This is useful in a model where inputs and outputs sit on different sheets.
Making inconsistencies visible with formulas
Keyboard tools find problems when you look. Formulas can keep looking for you. ISFORMULA and FORMULATEXT work on any cell reference:
=SUMPRODUCT(--NOT(ISFORMULA(D10:O10)))This counts the cells in the row that are not formulas. A forecast row should return 0. Put the check in a column to the right of the model and sum those results into a single check cell. The format [Green]"OK";[Red]"ERROR";[Green]"OK" from the model-checks chapter can then display the sum as a flag.
To compare a formula with the one next to it, use:
=FORMULATEXT(E10)This displays the formula as text. It is helpful in review sheets, though copied formulas that point to different columns will naturally show different text. Row differences (Ctrl+\) handles that case better.
Common errors
- Pressing Ctrl+[ on a cell with no formula. Nothing happens, which is easy to mistake for "no inputs".
- Treating Ctrl+[ as a full trace. It only selects direct precedents. Use Ctrl+Shift+{ to include indirect ones.
- Running Go To Special with one cell selected and expecting it to act on a block. It then searches the whole sheet, so you get far more cells than intended.
- Assuming an empty Constants result means the model is clean. Hardcodes inside a formula, such as
=D10*1.05, are formulas, not constants. Search for them with Show Formulas (Ctrl+`) or by scanning formulas with F2. - Leaving trace arrows on screen. Clear them with Alt+M, A, A before sharing the file.
- Ignoring hidden rows, columns, and sheets. Go To Special on a selection includes hidden cells, so check for them before you trust a result.
Exercise
A forecast row in E20:P20 should contain the same formula in every cell, but you suspect someone overwrote one cell. Give the keyboard sequence that finds the cell, and explain why a hardcode written as =F20*1.03 would not be found by the Constants option.
Show answer
Select E20:P20 starting from E20, so that E20 is the active cell, then press Ctrl+\ (row differences). Excel selects the cells whose R1C1 formula differs from the active cell. Alternatively, press Ctrl+G, Alt+S, then W. The expression =F20*1.03 is a formula that contains a typed number, so Excel classifies it as a formula, not a constant. Row differences finds it because its structure differs from its neighbors. Constants would only find a cell that holds a bare typed number.