← Learning Hub
Intermediate

Handling Errors in Formulas

Error values tell you something is wrong. Learn what each one means, then handle the expected ones politely.

Error values aren't failures - they're Excel telling you exactly what kind of problem it found. Knowing what each one means turns a confusing sheet into a quick fix. Some errors are expected (a lookup for a new product that isn't in the price list yet), and for those you can show a friendly message instead of an ugly error.

  • #N/A - a lookup found no match
  • #DIV/0! - dividing by zero or an empty cell
  • #VALUE! - the wrong type, like adding text to a number
  • #REF! - a cell the formula used was deleted
  • #NAME? - a misspelled function or name
  • #SPILL! - a dynamic array is blocked by other cells
  • ##### - not an error: the column is just too narrow

IFERROR and IFNA

Example
=IFERROR(B2/C2, 0)                                → 0 instead of #DIV/0!
=IFNA(VLOOKUP(F2, A2:B100, 2, FALSE), "Not found")
=XLOOKUP(F2, A2:A100, B2:B100, "Not found")       → XLOOKUP has its own "if not found"
Prefer IFNA for lookups. IFERROR hides every error, including real mistakes like a typo, which then go unnoticed.

Checking before you calculate

Example
=IF(C2=0, "", B2/C2)                   → blank instead of dividing by zero
=IF(ISNUMBER(A2), A2*1.18, "Enter a number")
=IF(ISBLANK(A2), "", ...)

Finding the cause

  • Click the cell and use Formulas → Evaluate Formula to watch Excel work it out step by step.
  • Trace Precedents draws arrows to the cells a formula uses.
  • Select part of a formula in the formula bar and press F9 to see its value (press Esc afterwards).
Key points
  • Each error type points to a different problem.
  • IFNA handles missing lookups; IFERROR hides all errors.
  • Evaluate Formula and Trace Precedents find the cause.

📝 Test yourself

1. What does #N/A usually mean?
2. Why prefer IFNA over IFERROR for lookups?
3. Fill in the function that shows 0 when B2/C2 fails:
=(B2/C2, 0)