Errors in Excel are unavoidable — but they don't have to be ugly. The IFERROR function in Excel lets you catch any error a formula produces and replace it with a custom value: a friendly message, a zero, a dash, or a completely blank cell. In this guide, you will learn exactly how IFERROR works, see six practical examples covering the most common real-world scenarios, and understand when to use IFNA instead.
IFERROR Syntax
The IFERROR function has just two arguments, making it one of the simplest functions to learn in all of Excel:
| Argument | Required? | What it means |
|---|---|---|
| value | Required | The formula or cell reference to check for an error. This is where you put your normal formula — VLOOKUP, a division, a calculation, etc. |
| value_if_error | Required | What to return if value produces an error. Can be text, a number, a blank string, another formula, or a cell reference. |
value. If the result is an error, it returns value_if_error. If the result is not an error, it returns the result as normal — IFERROR gets out of the way completely.
Which Errors Does IFERROR Catch?
IFERROR handles all seven standard Excel error types. Knowing what causes each one helps you decide whether to hide it with IFERROR or fix it at the source:
| Error | Common cause | Typical fix with IFERROR |
|---|---|---|
| #N/A | VLOOKUP / XLOOKUP cannot find the lookup value | "Not found" or "" |
| #DIV/0! | Dividing a number by zero or an empty cell | 0 or "—" |
| #VALUE! | Wrong data type — e.g. text where a number is expected | "Invalid input" |
| #REF! | A cell reference is broken — row or column was deleted | Fix the reference; hiding is not recommended |
| #NAME? | Excel doesn't recognise a function name — often a typo | Fix the typo; hiding masks the real issue |
| #NUM! | An impossible number — e.g. square root of a negative | 0 or "" |
| #NULL! | Incorrect use of space as a range operator | Fix the formula; rarely hidden intentionally |
#NAME?) or a broken reference (#REF!) with IFERROR, you will never see the real problem. Use IFERROR only when you deliberately expect and want to suppress a specific, predictable error.
Example 1: Hide a Division Error (#DIV/0!)
The most common reason to reach for IFERROR is dividing two numbers where the denominator can sometimes be zero — for example, calculating conversion rates, margins, or averages from a column that may contain blank cells.
"—" or "" when the blank result is meaningfully different from zero (e.g. no sales happened yet). Use 0 when a zero margin is a legitimate, chartable value.
Example 2: IFERROR with VLOOKUP
This is the single most common use of IFERROR in Excel. VLOOKUP returns #N/A whenever it cannot find a match. Wrapping it with IFERROR replaces that ugly error with a clear, user-friendly message.
if_not_found argument that does this automatically without needing IFERROR: =XLOOKUP(D2, A:A, B:B, "Not found"). It is cleaner and more efficient for new workbooks.
Example 3: IFERROR with INDEX MATCH
INDEX MATCH is more flexible than VLOOKUP — it can look left and handle multiple columns easily. Like VLOOKUP, it returns #N/A when no match is found. IFERROR wraps around it in exactly the same way.
Example 4: Return a Blank Cell Instead of an Error
Sometimes the cleanest fallback is simply nothing — an empty cell. This is useful for dashboards and reports where a visible message would look cluttered, or when the column will be summed and you want errors to contribute nothing.
"" looks empty but the cell is not technically blank — it still contains a formula. Functions like COUNTA will count it. If you need a truly blank cell, that requires a VBA approach; IFERROR cannot produce one.
Example 5: Nested IFERROR — Try Two Lookup Sources
You can nest one IFERROR inside another to build a fallback chain. This is useful when data lives across two separate tables — try the first table, and if that fails, try the second. If both fail, return a final message.
Example 6: Sum a Column That Contains Errors
When a column has errors scattered through it, a plain SUM propagates the error and returns nothing. Wrapping the individual values with IFERROR inside an array treats each error as zero before summing.
IFERROR vs IFNA — Which Should You Use?
Excel introduced IFNA in 2013 as a more targeted alternative to IFERROR. Choosing the right one depends on how much you want to hide:
- Catches all 7 error types
- Use when any error should be hidden — division errors, lookup errors, name errors, etc.
- Available in Excel 2007+
- Risk: can hide real bugs like #NAME? or #REF!
- Catches #N/A only
- Use with VLOOKUP / MATCH when you only expect a "not found" error
- Available in Excel 2013+
- Safer: other real errors like #VALUE! or #REF! remain visible
Quick-Reference: Common IFERROR Patterns
| Goal | Formula pattern |
|---|---|
| Show blank instead of error | =IFERROR(formula, "") |
| Show zero instead of error | =IFERROR(formula, 0) |
| Show custom text | =IFERROR(formula, "Not found") |
| VLOOKUP — hide #N/A | =IFERROR(VLOOKUP(…), "—") |
| INDEX MATCH — hide #N/A | =IFERROR(INDEX(MATCH(…)), "") |
| Try table 1, then table 2 | =IFERROR(VLOOKUP(…T1), IFERROR(VLOOKUP(…T2), "—")) |
| Sum a range with errors | =SUMPRODUCT(IFERROR(A1:A100, 0)) |
| #N/A only (lookup) — IFNA | =IFNA(VLOOKUP(…), "Not found") |
Frequently Asked Questions
-
What does IFERROR do in Excel? +IFERROR checks a formula for errors. If an error is found, it returns a value you specify — such as text, zero, or a blank cell. If no error is found, it returns the formula's normal result unchanged. It is the simplest and most common error-handling function in Excel.
-
What errors does IFERROR catch? +IFERROR catches all seven standard Excel error types: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, and #NULL!. It does not natively catch #SPILL! errors introduced with dynamic arrays in newer Excel versions.
-
What is the difference between IFERROR and IFNA? +IFERROR catches all error types, while IFNA catches only #N/A errors. Use IFNA with VLOOKUP when you only want to handle "not found" results — that way, other real errors like #VALUE! or #REF! remain visible and alert you to genuine problems in your data.
-
How do I return a blank cell instead of an error in Excel? +Use an empty string as the second argument:
=IFERROR(your_formula, ""). The cell will appear blank when an error occurs. Note that the cell still contains a formula — it is not truly empty — so COUNTA will count it. -
Can IFERROR slow down my Excel file? +IFERROR itself is lightweight. However, nesting heavy functions like VLOOKUP inside IFERROR means Excel evaluates the inner formula twice — once to detect the error and once to return the result. For large datasets this can slow recalculation. Consider XLOOKUP (built-in error handling) or IFNA (narrower scope) as alternatives.
-
Should I use IFERROR with VLOOKUP? +Yes — IFERROR with VLOOKUP is one of the most common Excel formula combinations. It prevents the #N/A error when a lookup value is not found. That said, if you are using Excel 365 or Excel 2021, XLOOKUP with its built-in
if_not_foundargument is a cleaner, faster, and more readable alternative.