IFERROR Function in Excel

Quick answer

IFERROR checks a formula and, if it returns any error such as #N/A or #DIV/0!, shows a value you choose instead. Reach for it when a lookup might not find a match or a calculation might divide by zero, and you’d rather see a clean result than an error.

IFERROR(value, value_if_error)

Works in: Every current version of Excel, including Excel 365, Excel 2024, 2021, 2019, 2016 and Excel for the web, on Windows and Mac (it’s been around since Excel 2007). Google Sheets has IFERROR with the same syntax.

Syntax

IFERROR(value, value_if_error)
ArgumentRequired?What it does
valueYesThe formula or cell to check. If it works out without an error, IFERROR returns its result unchanged.
value_if_errorYesWhat to return if value is any error (#N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME? or #NULL!). Can be text in double quotes, a number, a cell reference or another formula. Use "" to show a blank.

How IFERROR works

Think of IFERROR as “try this, and if it goes wrong, use this instead”. Excel works out value first. If the result is a normal number, text or date, IFERROR passes it straight through. Only when value comes back as an error does IFERROR swap in value_if_error.

It catches every error type, which is handy but blunt: it can’t tell a lookup that simply found no match from a formula that’s genuinely broken. IFERROR doesn’t fix anything. It only changes what the cell shows.

In Excel 365 and 2021 you can also hand it a whole range. It returns an array with every error replaced, so =SUM(IFERROR(D2:D5, 0)) totals a column that contains errors without needing Ctrl+Shift+Enter.

Examples

All three examples use the Bluegum Café workbook, with headers in row 1 on every sheet. The Basic example uses the Staff sheet with a Tips This Week column added in F. The other two use the Invoices sheet, extended to four July bills, and a new Payments sheet: the café’s July bank export with one row per supplier payment.

Staff IDNameRoleHourly RateHours This WeekTips This Week
S01Mia NguyenBarista$28.5032$48.00
S02Jack ThompsonCook$30.1038$57.00
S03Priya SharmaBarista$28.500$0.00
Invoice NoDateSupplierCategoryAmount ex GSTGSTTotal
INV-100103/07/2025Ridgeline RoastersCoffee beans$480.00$48.00$528.00
INV-100204/07/2025Coastal Dairy CoMilk$215.50$21.55$237.05
INV-100307/07/2025Surf Coast PackagingTakeaway cups$310.00$31.00$341.00
INV-100410/07/2025Ridgeline RoastersCoffee beans$480.00$48.00$528.00
Invoice NoDate PaidAmount Paid
INV-100108/07/2025$528.00
INV-100209/07/2025$237.05
INV-098704/07/2025$495.00
INV-100314/07/2025$341.00

Basic: Stop #DIV/0! when someone worked zero hours

On the Staff sheet, tips per hour worked is the tips in F2 divided by the hours in E2. The formula goes in G2 and is filled down to G4.

=IFERROR(F2/E2, 0)

Mia’s row returns $1.50 per hour (format column G as currency). Priya was on annual leave, so row 4 is 0 divided by 0. On its own that’s #DIV/0!; with IFERROR the result is 0, and a total of column G still adds up.

Real-world: Match July bank payments to supplier invoices

On the Payments sheet, the invoice number is in A2 and the formula goes in D2, filled down to D5. It looks up each payment in the Invoices register and returns the invoice total from column G.

=IFERROR(VLOOKUP(A2, Invoices!$A$2:$G$5, 7, FALSE), "Not in register")

D2 returns $528.00, matching the $528.00 that left the account. D4 returns Not in register: INV-0987 isn’t on the July register, so VLOOKUP’s #N/A is replaced with a note I can filter on before I sit down to do the BAS.

Advanced: Fall back to last financial year’s register

INV-0987 is a Ridgeline Roasters bill dated 26/06/2025 for $495.00, so it lives on the Invoices FY25 sheet (same layout, data in A2:G40). On the Payments sheet, the formula goes in E2 and is filled down to E5. The second lookup sits inside value_if_error, with its own IFERROR around it.

=IFERROR(VLOOKUP(A2, Invoices!$A$2:$G$5, 7, FALSE), IFERROR(VLOOKUP(A2, 'Invoices FY25'!$A$2:$G$40, 7, FALSE), "Not found"))

Rows 2, 3 and 5 match on the first lookup. Row 4 fails, so IFERROR hands over to the second lookup, which finds INV-0987 on the FY25 sheet and returns $495.00. Only a payment missing from both registers shows Not found.

Guru Tip

I only wrap IFERROR around a formula after I’ve checked the formula works. IFERROR hides every error, so if someone deletes a column in the register, the #REF! that should be shouting at you quietly becomes “Not in register” and the reconciliation looks fine when it isn’t. For lookups I use IFNA instead: it only catches #N/A (no match), so real breakages still show up.

Common errors

#NAME?: text in value_if_error isn’t in quotes

Cause: In =IFERROR(F2/E2, Not found), Excel reads Not found as a name that doesn’t exist. The error sits in IFERROR’s own argument, so IFERROR can’t catch it. A misspelt function, like IFEROR, does the same. Fix: Put text in double quotes, "Not found", and check the spelling of every function name.

#N/A: the fallback lookup also failed

Cause: IFERROR only checks value. If value_if_error is itself a lookup and it also finds nothing, its #N/A comes straight through. Fix: Wrap the fallback in its own IFERROR with a final message, as in the Advanced example above.

Grab the template: IFERROR

Every example on this page in one workbook, with the Staff, Invoices and Payments sheets set up so you can try the formulas on your own numbers.

Frequently Asked Questions

IFERROR catches every error type, while IFNA only catches #N/A, the error a lookup returns when it finds no match. IFNA is the safer choice around lookups because a #REF! or #VALUE! still shows. It works in Excel 2013 onwards and Google Sheets.

Use two double quotes as the second argument, like =IFERROR(F2/E2, ""). The cell looks empty but actually holds empty text, so ISBLANK will return FALSE for it.

Usually not. XLOOKUP has its own if_not_found argument that handles a missing match, and it leaves other errors visible, which is what you want.

Yes, with the same syntax. In Google Sheets the second argument is optional; leave it out and an error returns a blank.

Related functions

IF

IFNA

ISERROR