EXCELLYES

Excel IFERROR Function – The Clearest Guide You’ll Read in 2025

Handle Excel errors gracefully with IFERROR. Replace #N/A, #DIV/0!, and other errors with custom values or blanks.

Last updated: 26 Aug 2025 Reading time: 10–14 mins Skill level: Beginner → Pro
📑 On this page Syntax Quick Start VLOOKUP / XLOOKUP Text Cleanup Date Handling AVERAGE with IFERROR Avoid Divide by Zero Combine IF + IFERROR Tips & Gotchas FAQ

Syntax

IFERROR returns a custom result if a formula throws an error, otherwise it returns the formula’s normal result.

=IFERROR(value, value_if_error)

Quick Start (Copy & Use)

Handle Divide by Zero

=IFERROR(A2/B2, "")
A (Value)B (Divisor)Result
1001010 ✅
500(Blank)
75515
400(Blank)

VLOOKUP / XLOOKUP with IFERROR

VLOOKUP Safe Search

=IFERROR(VLOOKUP(E2, A:B, 2, FALSE), "Not found")
IDItem
101Apple
102Banana
103Orange
104Mango
Lookup ValueResult
101Apple
104Mango
105Not found
999Not found

XLOOKUP with Default

=XLOOKUP(E2, A:A, B:B, "Not found")

Note: XLOOKUP has a built-in “not found” argument, so IFERROR is optional here.

IDItem
101Apple
102Banana
103Orange
104Mango
Lookup ValueOutput
102Banana
104Mango
200Not found
500Not found

Text Cleanup

Convert Text to Number

=IFERROR(VALUE(A2), "Invalid number")
InputResult
123123
"45"45
abcInvalid number
(Blank)Invalid number

Date Handling

Days Between Two Dates

=IFERROR(DATEDIF(A2,B2,"d"),"Invalid date")
Start DateEnd DateResult
01-Jan-202505-Jan-20254
10-Feb-202515-Feb-20255
01-Mar-2025(Blank)Invalid date
Invalid05-Mar-2025Invalid date

AVERAGE with IFERROR

Safely Calculate Average

=IFERROR(AVERAGE(A2:A5), "No valid data")
ValuesResult
1015
20
15
#DIV/0!

Avoid Divide by Zero

Percentage Calculation

=IFERROR(Sales/Total, "")
SalesTotalResult
500100050%
20040050%
3000(Blank)
1000(Blank)

Combine IF and IFERROR

Wrap IFERROR around IF logic for safer dashboards.

=IFERROR(IF(A2>70,"Pass","Fail"),"Check input")
ScoreResult
85Pass
40Fail
#N/ACheck input
(Blank)Check input

Best Practices & Gotchas

  • Use IFERROR to hide user-facing errors.
  • Don’t overuse – errors may indicate real data issues.
  • Combine with IF for conditional error handling.
  • IFNA is a lighter alternative if you only want to catch #N/A.
  • For text and date formulas, IFERROR helps prevent “Invalid” showing in reports.

FAQ

What errors does IFERROR catch?

It catches #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, and #NULL!.

Is IFERROR available in all Excel versions?

Yes, since Excel 2007. For earlier versions, use IF(ISERROR(...),...,...).

How is IFERROR different from IFNA?

IFNA only handles #N/A, while IFERROR handles all errors.

Can I return a blank instead of an error?

Yes. Use =IFERROR(A1/B1,"").

Does IFERROR work in Google Sheets?

Yes, it works exactly the same in Sheets.

Can I use IFERROR with text or dates?

Yes. Use IFERROR(VALUE(A1),"Invalid number") for text or IFERROR(DATEDIF(A1,B1,"d"),"Invalid date") for dates.

What if my average or sum has an error?

Wrap your function: =IFERROR(AVERAGE(A1:A10),"No data").

Need a ready workbook?
Download the full Excel file with all IFERROR examples, answer keys, and a cheatsheet.

Found an issue? Tell us. We’ll fix it quickly.