Excel functions · Logic

IFERROR function in Excel

IFERROR returns the result of a formula, or a value you choose if that formula returns an error, such as 0 instead of #DIV/0! or "Not found" instead of #N/A. It catches every error type, so use it where you expect an error, not to hide mistakes.

Last reviewed

Syntax

=IFERROR(value, value_if_error)
valuerequired
The formula or value to check for an error.
value_if_errorrequired
What to return if value is an error such as #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME? or #NULL!.
  • IFNA catches only #N/A, which is safer for lookups: a broken reference still shows up.
  • IFERROR hides typos too. Build the formula first, then wrap it.

Which versions have IFERROR

Every current Excel version: Microsoft 365, Excel for the web, Excel 2024, 2021, 2019 and 2016, on Windows and Mac.

IFERROR availability by Excel version
VersionHas it
Microsoft 365 (Windows and Mac)Yes
Excel for the webYes
Excel 2024Yes
Excel 2021Yes
Excel 2019Yes
Excel 2016Yes

Google Sheets

Google Sheets has IFERROR. Its second argument is optional: leave it out and an error becomes a blank cell.

Examples

The examples use this sample sheet.

Rep revenue (A1:C4)
RowABC
1RepRevenueUnits
2Ana480040
3Ben00
4Cara315035
  1. 1.A division that works

    =IFERROR(B2/C2, 0)

    Result: 120

    4,800 / 40 has no error, so IFERROR returns it unchanged.

  2. 2.Catch #DIV/0!

    =IFERROR(B3/C3, 0)

    Result: 0

    Ben has 0 units, so B3/C3 would be #DIV/0!. IFERROR returns 0 instead.

  3. 3.Catch a failed lookup

    =IFERROR(VLOOKUP("Dev", A2:C4, 2, FALSE), "Not found")

    Result: Not found

    There's no Dev in the table, so VLOOKUP's #N/A becomes a message.

Common errors and fixes

IFERROR errors, causes and fixes
ErrorWhy it happensFix
Hidden mistakesIFERROR masks every error, including a #REF! from a deleted column or a #NAME? from a typo.Use IFNA for lookups, and check the unwrapped formula first.

Do it with GPTExcel

Skip writing IFERROR by hand

Upload your Excel or CSV file to Chat and ask in plain English. GPTExcel writes the formula for your file and your version of Excel or Google Sheets.

your-file.xlsx

Calculate revenue per unit for each rep and show 0 where units are 0.

Done. I used IFERROR on your sheet and checked the results against your data.

your-file-updated.xlsxYour original stays unchanged
  • Written for your platform and version
  • Checked against your actual data
  • Newest functions looked up in official docs
Try it free Formula Generator

Free plan, no credit card.

IFERROR questions

What's the difference between IFERROR and IFNA?
IFERROR catches every error type. IFNA catches only #N/A, the error lookups return when nothing matches, so real problems like #REF! still show.
Can IFERROR return a blank?
Yes: =IFERROR(B3/C3, "") shows an empty-looking cell instead of the error.

Skip the formula hunt

Upload a spreadsheet and ask in plain English. Free plan, no credit card.

Start free