← All how-to recipes

How to use IFERROR

✓ Verified in LibreOffice 25.8.7.3

Show a friendly value instead of an ugly error when a formula fails — clean up #N/A, #DIV/0!, and lookup misses.

The formula

AppFormulaNotes
Excel=IFERROR(A2/B2,0)IFERROR(formula, value if it errors). Catches EVERY error type; use IFNA to catch only #N/A.
Google Sheets=IFERROR(A2/B2,0)Identical.
LibreOffice Calc=IFERROR(A2/B2,0)Identical.

How it works

IFERROR runs the first argument and, if it produces any error, returns the second instead: 10/0 would be #DIV/0!, so IFERROR gives 0. The fallback can be a number, text ("Not found"), or a blank (""). Its most common use is wrapping lookups: =IFERROR(VLOOKUP(...),"-"). One caution worth knowing: IFERROR hides ALL errors, including real bugs like a #REF! from a deleted column or a #NAME? typo — so it can mask problems you'd want to see. When you only mean to handle a lookup miss, IFNA (which catches only #N/A) is the safer, more precise choice.

Verified, not just documented

We ran =IFERROR(A2/B2,0) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 0 — exactly the expected result. Every formula here is confirmed by actually executing it.