Look up in another table when VLOOKUP finds no match, and display invalid references

When VLOOKUP cannot find data in one table, you can use IFNA with a nested second VLOOKUP to continue the search in another table. At the same time, explain the common causes of the #REF! (invalid reference) error in formulas, and how to troubleshoot and fix each one.

Key points of this article

  • When VLOOKUP cannot find a match in the original table, it returns #N/A. Wrapping the original VLOOKUP in IFNA and calling a second VLOOKUP when it fails is safer than using IFERROR.
  • The lookup column in the second table must be the leftmost column of the range; otherwise, switch to INDEX combined with MATCH, or the formula will still fail after the table is changed.
  • #REF! usually means the column index number exceeds the width of the lookup range, or the table or range referenced by the formula has been deleted or moved.
  • When no data is found, first check the lookup value for extra spaces and for mismatched number and text formats. These problems are more common than issues with the table itself.
  • Use FALSE for exact matching in all lookup formulas, and recheck the referenced ranges after changing the table structure.

When using VLOOKUP in Excel, two situations come up often. First, the lookup can't find the matching person or ID in the source table, so the formula shows #N/A, even though the data you need is actually on another sheet. Second, the formula suddenly shows #REF!, indicating an invalid reference, even though it worked before. The two problems call for different approaches, and mixing them up easily makes things worse.

This article is written for readers who often do data reconciliation and report consolidation. After reading it, you will be able to do two things: use IFNA with a second VLOOKUP to look up values across tables, and diagnose which cause is behind a #REF! error based on its symptoms, then fix each one step by step. The methods below are based on the common desktop version of Excel. The interface may differ slightly between versions, but the formula syntax is universal.

When data can't be found, how do you switch to another table and keep looking? One-sentence conclusion

Wrapping the original VLOOKUP in IFNA is the straightforward approach: when the first table returns #N/A, it automatically looks up the value in the second table instead.

Your situationRecommended PracticesCause
Two tables have the same structure; the only difference is that their data is spread across different months or departments.IFNA nests two VLOOKUPs, both using FALSEThe formula should be short so it can be copied down a whole column, with clear logic.
The lookup column of the second table is not at the start of the rangeSwitch to INDEX plus MATCH, and look up in each of the two tables separatelyVLOOKUP can only return values to the right, and it cannot look up in the reverse direction.
The value you're looking for may appear in three or more tables.Nested multiple IFNA, or merging the tables into one helper tableToo many layers make the formula hard to maintain; after merging, it is easier to verify.
I only want to show a prompt when nothing is found, without changing the table.Return "Not found" with IFNAAvoid displaying #N/A directly in reports
The original table changes frequently and contains a large volume of data.Standardize all the tables into the same structure, then run a search again.Once the structure is unified, the formulas no longer need to be written separately for each table.

The basic formula is as follows, assuming the lookup value is in A2, the original table is in columns A and B of Sheet1, and the second table is in columns A and B of Sheet2:

=IFNA(VLOOKUP(A2,Sheet1!$A:$B,2,FALSE),VLOOKUP(A2,Sheet2!$A:$B,2,FALSE))

Note here: IFNA only catches #N/A. If you use IFERROR instead, it will replace all errors, including #REF!, so the real problem ends up being hidden.

First, determine which type of problem it is

SymptomsCommon causesHow to confirm
Shows #N/A, but the value is clearly in the tableLookup value has extra spaces, or number and text formats are inconsistentUse the LEN function in blank cells to count characters, and compare with the original values in the table.
#N/A is shown, but a different value can be looked up successfullyThe value is indeed not within the lookup range.Use the Filter or Find feature to search directly in the source table
Shows #REF!, and the third argument in the formula is quite large.The row number exceeds the width of the lookup area.Count how many columns the lookup range has, and compare it with the third argument.
Shows #REF!, and the formula contains the #REF! textThe table or range referenced by the official citation has been deleted or movedClick the formula to view it. If the reference directly shows #REF!, the reference is no longer valid.
The same spreadsheet opens fine for others, but it shows an error for you here.The referenced external file has been closed, and its path has changed.Check whether the formula contains a file path, and confirm whether the file is still in its original location

Item-by-item troubleshooting and fixing

Investigate in the following order: first address the causes that are easy to confirm, then deal with the structural problems.

  1. Confirm that the third argument is FALSE. If it is omitted or set to TRUE, VLOOKUP performs an approximate match, and the result may not be what you want. Change it to FALSE to get an exact match.
  2. Use the LEN function to check the number of characters in the lookup value. For example, enter =LEN(A2) in a blank cell and compare it with the character count of the same person's ID in the source table. Extra characters are usually spaces, which you can remove with the TRIM function.
  3. Check the number and text formats. If the IDs in the source table are text while the lookup value is a number, they will not match. You can use VALUE or TEXT in the formula to unify the format, and then look up again.
  4. Confirm that the lookup column is the first column of the lookup range. VLOOKUP can only search starting from the first column of the range. If the ID you are looking for is in the third column, adjust the range or use INDEX with MATCH instead.
  5. Check whether the third argument exceeds the number of columns. If the range is $A:$B, which has only two columns, but the third argument is 3, the formula returns #REF!. Change the argument to a number that does not exceed the number of columns in the range.
  6. Check whether the table names and ranges in the formula still exist. If the formula already shows #REF!, the referenced worksheet or range has been deleted. Select the correct range again to replace the invalid reference.
  7. For formulas that look up across sheets, test the two VLOOKUPs separately. First run the second VLOOKUP alone in a blank cell and confirm that it returns a result correctly, then put it back into IFNA.
  8. If the formula references files in other workbooks, first place the related files in the same folder, or copy the data into the current workbook, and then re-establish the references to avoid failures caused by path changes.

Why does #REF! appear?

#REF! in VLOOKUP mainly comes from two kinds of causes, and the fixes differ.

One category is column-index problems. This is a common situation, usually arising after copying a formula or adjusting the table structure. The lookup range has only two columns, but the formula asks for the content of the fifth column; Excel cannot locate it and returns #REF!. The fix is to check the width of the range so that the third argument matches the range, and to enlarge the range if necessary.

Another type is reference invalidation. When you delete a worksheet, delete an entire referenced range, or move data, the original references in formulas become #REF!. The fix is to reselect the correct lookup range so that the formula points to valid cells. Note that deleting a single column within the referenced range usually shrinks the range, whereas deleting the entire referenced range causes #REF!; the two produce different results.

How to Avoid This Happening Next Time

  • Standardize the format of lookup values. Key fields such as serial numbers and dates should be kept consistent when entered, to avoid mixing text and numbers.
  • Use whole-column or fixed ranges for the lookup areas in formulas, and check them once after changing the table structure. Before deleting or moving a source table, confirm whether any formulas still reference it.
  • Always write FALSE in lookup formulas instead of relying on the default approximate match, which reduces errors caused by changes in sort order.
  • For cross-table lookups that will be used long-term, consider merging multiple tables into one helper table, with a column indicating the source. This way only one VLOOKUP is needed, and errors are easier to locate.
  • After writing a formula, test it with a few rows of data whose results are already known to confirm the returned values are correct, then extend it to the whole column.

❓ Frequently Asked Questions (FAQ)

1. What is the difference between IFNA and IFERROR, and which one should I use?

IFNA only replaces #N/A errors, while IFERROR replaces all errors. When doing lookups in a table, IFNA is more appropriate, because it won't hide real problems such as #REF!.

2. Why does VLOOKUP sometimes show #N/A and sometimes show nothing when it can't find a value?

A blank display usually means the lookup result itself is empty, or the cell format is set to hide error values. You can add a check outside the formula so that blanks and not-found cases show different messages, which makes it easier to verify.

3. The number in the second table is on the right side, and VLOOKUP can't look it up. What should I do?

VLOOKUP can only return values from columns to the right of the lookup column; it cannot look up in reverse. You can instead use INDEX combined with MATCH: MATCH finds the row number, and INDEX retrieves the value from the corresponding column. Together, the two are not restricted by column position.

4. Why does the entire column show #REF! after copying a formula?

Usually the lookup range or column index in the formula has changed after copying, or the original range has become invalid. Check whether the references in the starting cell's formula are correct, then use absolute reference signs to lock the lookup range, and then copy it down again.

5. If I replace #N/A with "Not found," can the data still be used for statistics?

Yes, but pay attention to how the statistical functions handle the data. SUM ignores text, while COUNT does not count text cells, so before you calculate, it's best to first check which rows are still missing data, then decide how to handle them.

📝 Summary

VLOOKUP cannot find the data? Nest a second VLOOKUP inside IFNA to look up in another table, and the lookup proceeds smoothly, whereas IFERROR tends to hide the real errors. When you encounter #REF!, first check whether the column index number exceeds the range, then check whether the referenced table or range has been deleted. Troubleshoot item by item according to the symptoms, and most table-switching lookups and invalid reference problems can be fixed quickly.

Open OmniDoc and process your spreadsheet file

Updated 2026-11-29