How to Evaluate and Debug a Formula with F9 in Excel
To evaluate part of a formula in Excel, enter Edit mode with F2, select the portion you want to inspect, then press F9 to convert it to its calculated value in place. Press Esc to revert without changing the formula, or Enter to commit the substitution. On a Mac use Fn+F9 if function keys map to media controls.
What F9 actually does inside a formula
Pressing F9 outside Edit mode recalculates all open workbooks. The far more useful behavior, and the one analysts rely on for debugging, is the in-formula version: highlight any self-contained sub-expression while editing a cell and F9 replaces that fragment with the value it currently returns.
This lets you peel a long formula apart one argument at a time. Instead of guessing why =IF(AND(B2>0,C2<D2),E2*F2,0) returns the wrong number, you can select just AND(B2>0,C2<D2) and see whether it evaluates to TRUE or FALSE.
The critical rule: press Esc, not Enter, when you are done inspecting. Enter commits the substituted value and permanently hardcodes that part of the formula, which silently breaks the model.
- Click the cell containing the formula and press
F2to enter Edit mode. - Use the mouse or
Shift+Arrowkeys to select a complete, balanced sub-expression (a whole argument or function call). - Press
F9. Excel replaces the selection with its evaluated result. - Read the value, then press
Escto discard the change and restore the original formula. - Only press
Enterif you deliberately want to convert that fragment to a literal value.
| Key | Context | Result |
|---|---|---|
F9 | Normal mode | Recalculate all open workbooks |
F9 | Editing, with text selected | Evaluate selection to a value in place |
Shift+F9 | Normal mode | Recalculate the active sheet only |
Esc | After F9 in Edit mode | Revert the formula, discard the substitution |
Enter | After F9 in Edit mode | Commit the substitution (hardcodes it) |
Always exit with Esc when debugging so you do not accidentally hardcode a value.
Debugging a nested formula step by step
Nested IF, INDEX/MATCH, and SUMPRODUCT formulas are where F9 earns its keep. The trick is to evaluate from the inside out, confirming each layer before moving up.
Consider =INDEX(Revenue,MATCH(B2,Periods,0)). Select MATCH(B2,Periods,0) and press F9 to see which row position it resolves to. If it returns #N/A, the lookup value is the problem, not the INDEX. If it returns a sensible integer, the issue is the data range. This isolates the failure in seconds.
- Evaluate the innermost function first, then work outward.
- Select a balanced unit: a full function call or a complete argument, never a half-open parenthesis.
- If
F9returns an error like#REF!or#N/A, you have found the failing layer. - For array fragments,
F9shows the full array in braces, for example{1;2;3}, which reveals spill and dimension issues.
F9 vs the Evaluate Formula dialog
Excel also ships a guided debugger at Formulas > Evaluate Formula. It steps through the formula in calculation order and underlines the next expression to be resolved. Click Evaluate repeatedly to watch each piece collapse to a value.
Evaluate Formula is safer because it never alters the cell, and it shows precedence you might misjudge by hand. F9 is faster and more surgical when you already suspect a specific fragment. Most analysts use both: the dialog for an unfamiliar formula, inline F9 for a quick hypothesis check.
- Select the cell with the suspect formula.
- Go to Formulas > Evaluate Formula.
- Click Evaluate to resolve the underlined expression one step at a time.
- Use Step In to drill into a referenced cell's own formula, then Step Out to return.
- Click Close when finished. The original formula is untouched.
Formula Trace
F9 is great for spot-checking one fragment, but when a number is wrong three sheets away, ModelMint's Formula Trace walks the precedent chain for you and surfaces where the logic actually breaks, so you spend less time pressing F9 cell by cell.
Get ModelMint See how it worksFAQ
Does pressing F9 change my formula permanently?
Only if you press Enter afterward. While in Edit mode, F9 substitutes the selected fragment with its value on screen, but pressing Esc reverts it completely. Make a habit of exiting with Esc when you are only inspecting.
Why does F9 do nothing or change my screen brightness on a laptop?
On many laptops and on Mac, the function-key row defaults to hardware controls. Hold the Fn key (so Fn+F9) to send the actual F9 keystroke, or toggle the function-key lock in your keyboard settings.
What is the difference between F9 and Shift+F9?
F9 recalculates every open workbook. Shift+F9 recalculates only the active worksheet, which is faster in a large model where you just changed one sheet. Ctrl+Alt+F9 forces a full rebuild of all formulas even if Excel thinks they are unchanged.