Using IFERROR with VLOOKUP in Excel prevents #N/A or other error values from appearing when a lookup fails, returning a custom message or value instead. This combination makes spreadsheets more user-friendly and avoids breaking downstream calculations.
What You'll Need
- Microsoft Excel (any modern version: 2010, 2013, 2016, 2019, 2021, or Microsoft 365)
- A dataset with a table to search (the table array)
- A cell containing the value you want to look up (the lookup value)
- Basic familiarity with entering formulas in Excel
Step-by-Step
- Open your Excel workbook and ensure your lookup table is properly formatted with clear column headers and no blank rows or columns within the data range. For example, suppose you have product IDs in column A (A2:A100) and corresponding prices in column B (B2:B100).
- Click the cell where you want the result to appear—for instance, cell D2.
- Start typing the formula:
=IFERROR(VLOOKUP(. Note that Excel will auto-suggest the function as you type. - Enter the lookup value. This is typically a cell reference containing the value you want to find, such as
C2(if C2 holds the product ID you’re searching for). - After the lookup value, add a comma, then specify the table array: the range containing all the columns you need to search and return data from. For our example, type
A2:B100. Ensure the lookup value exists in the first column of this range (column A here). - Add another comma, then enter the column index number—the position of the return column within the table array, counting from left to right starting at 1. Since prices are in the second column of A2:B100, enter
2. - Add a comma, then type
FALSEfor exact match. Using TRUE or omitting this argument can cause incorrect results if your data isn’t sorted. - Add a final comma, then enter the value you want to display if the VLOOKUP returns an error—such as
"Not Found",0, or""(blank). For example:"Not Found". - Close the parentheses and press Enter. Your full formula should look like:
=IFERROR(VLOOKUP(C2,A2:B100,2,FALSE),"Not Found"). - Drag the fill handle (small square at the bottom-right of the cell border) down to copy the formula to other rows. Verify that rows without matches show your custom message instead of #N/A.
Common Mistakes
- Forgetting to sort data when using approximate match (TRUE or omitted match_type). IFERROR hides the error but won’t fix incorrect matches.
- Using the wrong column index number—remember it’s relative to the table array, not the entire worksheet column.
- Leaving spaces or non-printing characters in the lookup value or table, causing mismatches. Use
TRIM()orCLEAN()if needed. - Referencing the wrong cell for the lookup value—double-check that the reference points to the correct cell.
- Using IFERROR to mask all errors, including legitimate ones like #REF! or #DIV/0!. It’s better to fix the root cause instead of hiding it.
Tips
- Combine IFERROR with XLOOKUP (available in Microsoft 365) for more flexibility: XLOOKUP doesn’t require the lookup column to be first and handles errors more intuitively.
- Use
""instead of"Not Found"to leave the cell blank, reducing visual clutter in reports. - Test your VLOOKUP without IFERROR first to confirm it works, then wrap it in IFERROR once you’re confident in the structure.
- Apply conditional formatting to highlight cells containing
"Not Found"to quickly identify missing data. - If your data spans multiple sheets, use sheet names in the table array (e.g.,
Products!A2:B100) and ensure sheet names with spaces are quoted (e.g.,'Sales Data'!A2:B100).
Troubleshooting
If your IFERROR + VLOOKUP formula still shows errors or unexpected results, follow these steps:
- Check for #N/A in the VLOOKUP alone: Temporarily remove IFERROR by deleting everything after the final comma and closing parenthesis. If #N/A appears, the lookup itself is failing—proceed to step 2.
- Verify the lookup value exists: Use Ctrl+F to search the first column of your table array for the exact lookup value. If it’s not found, the mismatch could be due to extra spaces, different formatting (e.g., text vs. number), or a typo.
- Check data types: Select both the lookup value cell and the first column of the table array, right-click > Format Cells, and ensure they match (e.g., both General or both Text). Mismatched types cause silent failures.
- Confirm the table array range: Make sure the range includes all necessary rows and columns and starts with the lookup column. A missing row or shifted range can cause #REF! or wrong data.
- Inspect for hidden characters: In a blank cell, enter
=CODE(LEFT(A2))to check the ASCII code of the first character in A2. If it’s not 32 (space) or a standard letter/number, use=CLEAN(TRIM(A2))to clean the data. - Test with a simple example: Create a tiny test table (e.g., A1:B3) with known values and try the formula on those. If it works, the issue is likely with your main dataset’s structure or content.
Frequently Asked Questions
Does IFERROR work with all Excel error types, not just #N/A?
Yes. IFERROR catches #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME?, and #NULL!—any error value—and returns your specified fallback value. However, it’s best practice to resolve underlying issues (e.g., #DIV/0! from division by zero) rather than hide them.
Can I use IFERROR with multiple VLOOKUPs in one formula?
Yes, you can nest VLOOKUPs inside IFERROR, but it’s often clearer to use separate IFERROR wrappers or switch to XLOOKUP. For example: =IFERROR(VLOOKUP(A1,Table1,2,FALSE),IFERROR(VLOOKUP(A1,Table2,2,FALSE),"Not Found")) searches two tables sequentially.
Why does my formula show #NAME? instead of "Not Found"?
#NAME? means Excel doesn’t recognize part of your formula—usually due to a typo in a function name (e.g., VLOKUP), missing quotes around text (e.g., Not Found without quotes), or referencing an undefined name. Double-check spelling and quotation marks.
Does IFERROR slow down large spreadsheets?
Minimally. Each IFERROR adds a small calculation step, but modern Excel handles thousands of such formulas efficiently. Performance issues are more likely caused by volatile functions (e.g., INDIRECT, OFFSET) or huge ranges than IFERROR itself.
Can I return a different message for different errors?
No—IFERROR treats all errors identically. To differentiate, use IF with ISNA (for #N/A specifically) or combine with ISERROR and nested IFs. Example: =IF(ISNA(VLOOKUP(...)),"Missing",IF(ISERROR(VLOOKUP(...)),"Other Error","Result")).
What if my lookup table is on another workbook?
It works the same—just include the full workbook and sheet reference in the table array. Example: =IFERROR(VLOOKUP(C2,'[Sales 2024.xlsx]Data'!A2:B100,2,FALSE),"Not Found"). Ensure the source workbook is open when you first enter the formula, or Excel may prompt to update links.