← All how-to recipes

How to use IFERROR

✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)

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 (desktop)=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. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 0 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.

Functions used

IFERROR — see full Excel, Google Sheets & LibreOffice compatibility for each.

Related recipes

Related comparisons