The quickest way to handle errors from VLOOKUP is to wrap it in IFERROR: =IFERROR(VLOOKUP(...), "Not Found"). This formula returns your custom text (or a blank, zero, or another value) instead of the ugly #N/A error when the lookup value isn’t found.
Why VLOOKUP Returns Errors
VLOOKUP returns an error when it cannot find a match or when something else goes wrong. The most common error is #N/A, which means the lookup value is not present in the first column of your table array. Other errors include #REF! (the table array is invalid) and #VALUE! (the lookup value is typed incorrectly). Understanding the cause helps you decide whether to hide the error or fix the underlying data.
How IFERROR Works
IFERROR takes two arguments: the value you want to check, and the value to return if that first argument is an error. The syntax is =IFERROR(value, value_if_error). It catches all error types, not just #N/A. For example, =IFERROR(1/0, "Division by zero") returns “Division by zero” because dividing by zero produces #DIV/0!.
Basic IFERROR with VLOOKUP Example
Suppose you have employee IDs in column A (A2:A10) and you want to look up their department from a table in D2:E10 (ID in D, department in E). In cell B2, enter:
=IFERROR(VLOOKUP(A2, $D$2:$E$10, 2, FALSE), "Not found")
Drag the formula down. If an ID in column A doesn’t exist in D, the cell shows “Not found” instead of #N/A. The FALSE argument forces an exact match, which is almost always what you want with text IDs.
Choosing What to Return Instead of an Error
You can return almost anything in the second argument. Common choices:
- Text:
"Not found"or"N/A"– clear for human readers. - Blank:
""(two double quotes) – makes the cell look empty, which is useful for charts or further calculations. - Zero:
0– if you’re summing the results and don’t want missing values to affect the total. - Another formula: You can nest another VLOOKUP or a different function, but keep it simple to avoid confusion.
Consider your downstream use. If you’re averaging the results, a blank is treated as zero in AVERAGE, but a text like “Not found” would cause a #VALUE! error in that average. So choose based on what you’ll do next.
Common Problems and Misconceptions
A frequent mistake is wrapping VLOOKUP in IFERROR but still getting errors. This happens if the error is in the table array itself, like a #REF! because you deleted a column. IFERROR catches that too, so you’d see your custom message, but the underlying data is broken – fix the table range instead of hiding it.
Another misconception: IFERROR hides all errors, which can mask real problems. For example, if your lookup value is a number stored as text, VLOOKUP might return #N/A because of a type mismatch. IFERROR will hide that, but the correct fix is to convert the data types. Use IFERROR only when you expect missing values as a normal part of your data.
Also note: IFERROR is not the same as IFNA. IFNA (=IFNA(VLOOKUP(...), "Not found")) only catches #N/A errors, leaving other errors visible. Use IFNA if you want to see genuine errors like #REF! or #VALUE!.
Alternatives to IFERROR with VLOOKUP
If you’re using Excel 2021 or Microsoft 365, XLOOKUP is a modern replacement that handles errors natively. The syntax is =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found]). For the same example, you’d write:
=XLOOKUP(A2, $D$2:$D$10, $E$2:$E$10, "Not found")
This is cleaner because the “if not found” argument is built in, and XLOOKUP doesn’t require a column index number. Another alternative is to use IF with ISNA: =IF(ISNA(VLOOKUP(...)), "Not found", VLOOKUP(...)) – but that repeats the VLOOKUP twice and is harder to read. IFERROR is the simplest and most widely compatible.
Frequently Asked Questions
Why does my IFERROR VLOOKUP still show #N/A?
If you see #N/A, you haven’t actually wrapped the VLOOKUP in IFERROR, or the formula has a typo. Check that you typed =IFERROR( at the start and closed the parentheses correctly. Also ensure the VLOOKUP itself is valid – for example, the column index number is within the table range.
Can I use IFERROR with VLOOKUP to return a blank cell?
Yes, use two double quotes as the second argument: =IFERROR(VLOOKUP(...), ""). The cell will appear empty, but it still contains a formula. If you want a truly blank cell with no formula, you’d need to delete the formula, but that’s rarely necessary.
Does IFERROR work in Google Sheets?
Yes, IFERROR and VLOOKUP work the same in Google Sheets. The syntax is identical, and you can use the same formula. In Google Sheets, you can also use IFNA for only #N/A errors.
What’s the difference between IFERROR and IFNA?
IFERROR catches any error type (#N/A, #VALUE!, #REF!, #DIV/0!, #NAME?, #NUM!, #NULL!). IFNA only catches #N/A. Use IFNA if you want to see other errors because they indicate a problem you need to fix.
How do I use IFERROR with VLOOKUP to return a value from another column?
You can’t directly return a different column’s value in the error case; the second argument of IFERROR is a static value or a formula. If you want to fall back to another lookup, you can nest another VLOOKUP: =IFERROR(VLOOKUP(A2, Table1, 2, FALSE), VLOOKUP(A2, Table2, 2, FALSE)). This tries the first table, then the second.
Can IFERROR hide a real problem in my data?
Yes, because it suppresses all errors. For example, if your table has duplicate IDs and VLOOKUP returns the first match, that’s not an error, but if your lookup value is misspelled, you’ll get #N/A and IFERROR will hide it. Always verify that the errors you’re hiding are expected missing values, not typos or broken references.
Related
- Earn From Home Computer Data Entry: Real Options
- Split CSV File with Python: 6 Real Methods
- Shortcut for cmd? (Open Command Prompt Fast)
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Errors & fixes
- ISBLANK Not Working on a Cell With a Formula?Yes—this is usually expected behavior, not a problem with Excel. ISBLANK returns FALSE when a cell contains a…
- Circular Reference in Excel: How to Find and Fix ItTo fix a circular reference in Excel, open Formulas > Error Checking > Circular References, select a listed…
- Excel File Keeps Getting Corrupted? Causes and FixesIf an Excel file keeps getting corrupted, first make a copy of it, then try Excel’s built-in repair:…
- Which One Is Not an Aggregate Function? SQL GuideA scalar function such as UPPER() is not an aggregate function: it transforms a value in an individual…
- INDEX MATCH Excel Spill Error: Causes and Fixes ExplainedAn INDEX/MATCH formula usually returns one value, so a #SPILL! error means Excel is trying to return results…
- SUMIF Not Working in Excel? How to Find and Fix ErrorsIf SUMIF is not working in Excel, first check that the criteria range and sum range cover the…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.