The direct answer: wrap your VLOOKUP in ISERROR to catch errors like #N/A, using the pattern =IF(ISERROR(VLOOKUP(...)),"Not Found",VLOOKUP(...)). This returns a friendly message instead of an error when the lookup value isn’t found. For a cleaner approach in Excel 2021 or Microsoft 365, use IFERROR or XLOOKUP.
What ISERROR and VLOOKUP Do
VLOOKUP searches for a value in the first column of a table and returns a value from another column in the same row. It returns #N/A when the lookup value is not found, or when the table array is wrong. ISERROR is a function that checks whether its argument is any error value (#N/A, #VALUE!, #REF!, etc.) and returns TRUE if it is, FALSE otherwise. Combining them lets you test the VLOOKUP result before displaying it.
Basic ISERROR with VLOOKUP Formula
Assume you have a product ID in cell A2, a lookup table in D2:E10 (IDs in D, prices in E), and you want the price in B2. Use:
=IF(ISERROR(VLOOKUP(A2,$D$2:$E$10,2,FALSE)),"Not Found",VLOOKUP(A2,$D$2:$E$10,2,FALSE))
This checks if VLOOKUP returns an error; if TRUE, it shows “Not Found”; if FALSE, it shows the actual price. Note that VLOOKUP is called twice, which can slow down large spreadsheets.
IFERROR: The Modern Replacement
In Excel 2007 and later, IFERROR is simpler and faster because it evaluates the formula only once:
=IFERROR(VLOOKUP(A2,$D$2:$E$10,2,FALSE),"Not Found")
IFERROR catches all errors, not just #N/A. If you only want to catch #N/A and leave other errors visible, use IFNA (Excel 2013+):
=IFNA(VLOOKUP(A2,$D$2:$E$10,2,FALSE),"Not Found")
For Microsoft 365 and Excel 2021, XLOOKUP is even better because it has a built-in if_not_found argument:
=XLOOKUP(A2,$D$2:$D$10,$E$2:$E$10,"Not Found")
When to Use ISERROR vs IFERROR vs IFNA
- Use ISERROR when you need to test for any error and then perform a different calculation or action (e.g., sum only non-error values).
- Use IFERROR when you want a simple default value for any error.
- Use IFNA when you only want to handle #N/A and let other errors (like #VALUE!) show so you can debug them.
- Use XLOOKUP if you have Microsoft 365 or Excel 2021; it is more flexible and avoids double calculation.
Common Problems and Solutions
Problem: ISERROR with VLOOKUP returns “Not Found” even when the value exists. Solution: Check that the lookup column is the first column of the table array, and that the range is absolute (with $ signs) if you copy the formula down. Also ensure the lookup value and the table column are the same data type (text vs number).
Problem: The formula returns #VALUE! instead of a message. Solution: This happens if the lookup value is not found and you use ISERROR incorrectly, or if there is a different error. Use IFERROR to catch all errors, or check for extra spaces in the lookup value.
Problem: Performance is slow with many VLOOKUPs. Solution: Avoid using ISERROR with two VLOOKUPs; use IFERROR or XLOOKUP instead. Also consider using approximate match (TRUE) if your data is sorted, but be careful with exact matches.
Frequently Asked Questions
Does ISERROR catch all VLOOKUP errors?
Yes, ISERROR catches any error that VLOOKUP returns, including #N/A, #VALUE!, #REF!, and #NAME?. However, if you only want to catch #N/A (the most common), use IFNA or ISNA.
Can I use ISERROR with VLOOKUP to return a blank cell?
Yes, replace the “Not Found” text with an empty string: =IF(ISERROR(VLOOKUP(...)),"",VLOOKUP(...)) or =IFERROR(VLOOKUP(...),"").
Why does VLOOKUP return #N/A even though the value is in the table?
Common causes: the lookup value has extra spaces, the table array doesn’t include the lookup column as the first column, or the data types don’t match (e.g., one is text and the other is a number). Use the TRIM function on the lookup value, and ensure the table range is correct.
Is there a way to avoid double calculation with ISERROR?
Yes, use IFERROR or XLOOKUP. IFERROR evaluates the formula once, while ISERROR with two VLOOKUPs evaluates twice. For large datasets, this can be noticeably slower.
Can I use ISERROR with VLOOKUP in Google Sheets?
Yes, the same functions work in Google Sheets. However, Google Sheets also has IFERROR and IFNA, and XLOOKUP is available as of 2022. The syntax is identical.
Alternatives and Best Practices
For exact-match lookups, consider using INDEX/MATCH instead of VLOOKUP. It is more flexible and doesn’t require the lookup column to be first. For example:
=IFERROR(INDEX($E$2:$E$10,MATCH(A2,$D$2:$D$10,0)),"Not Found")
This is often faster than VLOOKUP and works in all Excel versions. For Microsoft 365, XLOOKUP is the recommended choice because it handles errors natively and supports both vertical and horizontal lookups.
When using ISERROR, remember that it catches all errors, which can mask real problems like a broken formula. Use IFNA if you only want to hide #N/A, and keep other errors visible for debugging.
Related
- Power Automate Split Outputs: How To Use
- Balloon Number 7 Foil? Meaning & Real Answer
- Selected Cell How Many Values? Excel Count Explained
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Errors & fixes
- Excel 3D Map Not Working? Causes, Checks, and FixesIf Excel 3D Maps is not working, first confirm that you are using the Windows desktop version of…
- Excel Filter Not Working? Fix the Most Common CausesIf an Excel filter is missing rows, showing unexpected results, or not responding, first check that the filter…
- COUNTIFS Function Not Working? Fix Common ErrorsIf COUNTIFS is not working, check that every criteria range has the same size and shape, then verify…
- Excel Workbook Keeps Freezing? Troubleshooting GuideIf an Excel workbook keeps freezing, first give it a minute to finish, then save a copy if…
- Why Is Hanging Indent Not Working in Word?A hanging indent in Word usually fails because the wrong paragraph or setting is being changed, or because…
- HLOOKUP Not Working? Fix Common Microsoft Excel ErrorsIf HLOOKUP is not working in Excel, first check that the value you want to find is in…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.