Catch Any Formula Error With IFERROR
One order row has zero quantity, so your price-per-unit column shows #DIV/0! — which poisons the SUM at the bottom and makes the whole report look broken.
Excel & Google Sheets
This formula works in both Excel and Google Sheets.
How it works
IFERROR runs your calculation and, only if it fails, returns the fallback instead — and it catches every error type: #DIV/0!, #N/A, #VALUE!, #REF!, #NAME?, and #NUM!. Returning 0 is the popular fallback for numeric columns because a 0 flows cleanly into every SUM and running total below it, so one bad row no longer breaks the report. The trade-off is that a fallback 0 looks exactly like a real zero, so for columns people read directly, many prefer "" to keep missing data visible. When the only error you expect is a failed lookup, reach for IFNA instead — it catches #N/A but lets genuine bugs like #REF! stay loud. That selectivity is the point: IFERROR silences everything, including the errors you needed to see.
When to use it
Use it where errors are expected and harmless: revenue per order when an order count can be zero, VLOOKUPs against a customer list that's still being filled in, month-over-month change when last month had no sales.
Common mistakes
Did this formula help?
Engine-verified against the sample data aboveLast reviewed 2026-07-08