Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

VLOOKUP Excel If Not Found: How to Handle #N/A Errors

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To handle a VLOOKUP when a value is not found, wrap your VLOOKUP formula inside the IFERROR function. For example, use =IFERROR(VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup]), "Not Found"). This replaces the standard #N/A error with a custom message, a zero, or a blank cell, making your spreadsheets professional and easier to read.

By default, Excel returns a #N/A error whenever the VLOOKUP function cannot find the lookup value in the first column of your table array. While this is technically accurate, it can be disruptive when you are building dashboards, invoices, or data reports. Using an error-handling wrapper allows you to define exactly what happens when data is missing, preventing the error from cascading through other formulas that might rely on that cell.

What You'll Need

  • Microsoft Excel (any version that supports VLOOKUP and IFERROR, including Excel 365, 2021, 2019, and 2016).
  • A dataset containing a lookup value (the item you are searching for).
  • A source table (the range where the data is stored).
  • Basic knowledge of how to enter a formula into a cell.

Step-by-Step

  1. Identify your basic VLOOKUP formula: Before adding the "if not found" logic, ensure your standard VLOOKUP is working. For example, if you are searching for an Employee ID in cell A2 within a table located in range G2:H100 and want the name from the second column, your formula is: =VLOOKUP(A2, G2:H100, 2, FALSE).
  2. Determine your fallback value: Decide what you want to see instead of #N/A. Common choices include a text string like "Not Found" or "Missing", a numerical value like 0, or a completely blank cell (represented by two double quotes "").
  3. Insert the IFERROR function: Click on the cell containing your VLOOKUP. In the formula bar, type =IFERROR( immediately after the equals sign. This opens the IFERROR function, which takes two arguments: the value to check and the value to return if an error is found.
  4. Place the VLOOKUP inside the brackets: Your VLOOKUP formula now becomes the first argument of the IFERROR function. It should look like this: =IFERROR(VLOOKUP(A2, G2:H100, 2, FALSE),.
  5. Add the custom "Not Found" message: After the comma following the VLOOKUP closing parenthesis, type your chosen fallback value. If using text, ensure it is enclosed in double quotes. For example: =IFERROR(VLOOKUP(A2, G2:H100, 2, FALSE), "Not Found").
  6. Close the parenthesis and press Enter: Ensure there is a final closing parenthesis to shut the IFERROR function. Press Enter to apply the formula.
  7. Drag the fill handle: Click the small green square at the bottom-right corner of the cell and drag it down to apply the error-handling VLOOKUP to the rest of your column.

Common Mistakes

One of the most frequent errors is forgetting the FALSE (or 0) argument at the end of the VLOOKUP. If you omit this or set it to TRUE, Excel performs an approximate match. This means if the exact value isn't found, Excel will return the next largest value that is smaller than your lookup value, which often looks like a successful result but is actually the wrong data. This prevents the IFERROR function from ever triggering because the VLOOKUP technically "found" something, even if it was the wrong item.

Another common mistake is placing the quotes incorrectly. In Excel formulas, any literal text must be wrapped in double quotes. Writing =IFERROR(VLOOKUP(...), Not Found) without quotes will cause Excel to think "Not Found" is a named range or a function, resulting in a #NAME? error. Similarly, if you want a blank cell, you must use "". A single quote or no quotes will not work.

Users also frequently forget to lock their table arrays. When you drag a VLOOKUP formula down, the table range (e.g., G2:H100) shifts down as well (G3:H101, G4:H102). This causes the formula to "miss" data at the top of the list, triggering the "Not Found" message even when the data exists. Always use absolute references (dollar signs) for your table array, such as $G$2:$H$100.

Tips

For those using newer versions of Excel (Office 365 or Excel 2021), consider using XLOOKUP instead of VLOOKUP. XLOOKUP has a built-in argument for missing values, eliminating the need for IFERROR. The syntax is =XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found]). You can simply put your "Not Found" text directly into the fourth argument of the function, making the formula shorter and faster to process.

If you are dealing with very large datasets, be mindful that wrapping thousands of cells in IFERROR can slightly slow down calculation speeds, though this is rarely noticeable on modern computers. To keep your sheet clean, you can use Conditional Formatting to highlight cells that return "Not Found" in red, allowing you to quickly spot missing data entries that need to be manually added to your source table.

If you need different messages for different types of errors, you can use the IFNA function instead of IFERROR. While IFERROR catches every possible error (including #VALUE! or #REF!), IFNA specifically only catches the #N/A error. This is safer because if you have a typo in your formula that causes a #REF! error, IFNA will let you know there is a problem with the formula, whereas IFERROR would simply hide it by displaying "Not Found".

Troubleshooting

If your formula is still returning #N/A despite using IFERROR, check for nested parentheses. A missing closing parenthesis for the VLOOKUP function will prevent the IFERROR function from closing properly, often resulting in a formula error alert from Excel. Ensure every opening bracket has a corresponding closing bracket.

If the formula returns "Not Found" but you can clearly see the value exists in the table, the issue is likely data type mismatch. This happens when your lookup value is stored as text but the source table contains numbers (or vice versa). To fix this, select the column of data, go to the Data tab, select Text to Columns, and click Finish immediately; this often resets the data types to a consistent format. Alternatively, use the VALUE() function or TEXT() function within your VLOOKUP to force the types to match.

Check for hidden spaces. A cell containing "Apple " (with a trailing space) will not match a cell containing "Apple". You can resolve this by wrapping your lookup value and your table range in the TRIM() function, which removes all leading and trailing spaces. For example: =IFERROR(VLOOKUP(TRIM(A2), TRIM($G$2:$H$100), 2, FALSE), "Not Found"). Note that using TRIM on a range requires pressing Ctrl+Shift+Enter in older versions of Excel as it is an array formula.

Frequently Asked Questions

Can I leave the cell blank instead of saying "Not Found"?

Yes. Instead of typing "Not Found" as the second argument of the IFERROR function, use two double quotes with nothing between them: "". This tells Excel to return an empty string, leaving the cell looking blank.

Does IFERROR work with other lookup functions?

Yes, IFERROR is a universal wrapper. It works exactly the same way with HLOOKUP, INDEX/MATCH, and XLOOKUP (though XLOOKUP has its own built-in alternative).

Why is my VLOOKUP returning the wrong value instead of "Not Found"?

This usually happens because the fourth argument of the VLOOKUP is set to TRUE or is missing. This triggers an approximate match. Change the last argument to FALSE to ensure Excel only returns an exact match or triggers the error handler.

Will IFERROR hide actual mistakes in my formula?

Yes, that is the primary risk. IFERROR catches all errors. If you accidentally delete a column in your source table, the VLOOKUP would normally show #REF!. With IFERROR, it will simply show "Not Found", which might lead you to believe the data is missing when the formula is actually broken. Use IFNA to avoid this.

Can I use a formula as the "Not Found" result?

Yes. Instead of a text string, you can place another formula in the second argument of IFERROR. For example, you could have it perform a second VLOOKUP in a different table if the first one fails.