A VLOOKUP #REF! error means Excel cannot use a reference required by the formula. Most often, the formula asks for a return column beyond the width of its lookup range; check the range and column number first, then repair any reference that displays #REF! directly.
What the VLOOKUP #REF! error means
#REF! is Excel’s invalid-reference error. VLOOKUP needs a valid table range and a valid column number telling it which column in that range should supply the answer. If either reference is no longer usable, Excel cannot complete the lookup and returns the error.
This is different from #N/A. That error usually means an exact-match lookup did not find the requested value in the first column of the table. With #REF!, the problem is generally the formula’s structure or an invalid cell or range reference—not simply a missing customer, product, or other lookup value.
For context, VLOOKUP uses this syntax: =VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup]). The first argument is the value to find, the second is the lookup table, the third is the number of the return column counting from the table’s left edge, and the optional fourth argument controls approximate or exact matching.
Check the return-column number against the range
The most common cause is a col_index_num that is larger than the number of columns in table_array. The number is relative to the selected range, not the worksheet’s column letters. For example, column A is number 1 only when the table range starts in A; if the range starts in B, column B is number 1.
Suppose product codes are in A, descriptions in B, and prices in C, with a code to search for in E2. With the lookup table in A2:C100, there are three columns. A request for column 4 is impossible, so VLOOKUP returns #REF!.
With product codes in A2:A100, descriptions in B, prices in C, and the lookup code in E2, this formula requests the fourth column from a three-column range and returns #REF!: =VLOOKUP(E2,A2:C100,4,FALSE).
With the same cell layout, this formula requests the third column, so it can return the price from column C when the code is found: =VLOOKUP(E2,A2:C100,3,FALSE). If E2 contains a code found in A2:A100, the result is its corresponding value from column C.
Count the range’s columns rather than copying a column number from another formula. For instance, the range B2:D100 has three columns: B is 1, C is 2, and D is 3. Asking for column 4 from B2:D100 also produces #REF!.
Other causes: broken or changed references
A formula may contain an invalid reference because a referenced cell, range, or worksheet was deleted or otherwise changed. In some cases Excel adjusts a reference automatically when cells are moved or deleted; in others, the formula displays #REF! where the old address used to be. The visible formula is useful evidence: if you see something like =VLOOKUP(E2,#REF!,2,FALSE), the table range itself is broken.
Edits can also expose a fragile formula. A VLOOKUP might work while its table has four columns, then return #REF! after someone narrows the range to three columns without updating the index. Copying a formula between worksheets or editing a named range can likewise leave the table reference pointing somewhere unintended or invalid.
- Deleted source data: A referenced range or sheet was removed, and Excel could not preserve the reference.
- Changed lookup range: The range now has fewer columns than the return index requests.
- Damaged formula text: A manual edit replaced a valid address or range name with an invalid reference.
- Copied formula: A relative reference shifted when the formula was filled into another row or column.
Do not assume every formula involving deleted columns must break. Excel often revises references to reflect structural edits. The reliable test is to inspect the current formula and its evaluated range, not to guess what an earlier version of the worksheet looked like.
A practical way to diagnose and fix it
Start with one cell showing the error and inspect the formula in the formula bar. In Microsoft 365 for Windows, select the cell and read the formula bar above the worksheet; you can also double-click the cell to inspect the formula in place. Follow these checks in order:
- Find the table range. Identify the second argument, such as
A2:C100, and confirm that it refers to the intended data, including the lookup column and the return column. - Count its columns. For a range from A through C, count three. For a range from B through D, also count three. Do not use the worksheet column letter as the index automatically.
- Compare the index. The third argument must be between 1 and the number of columns in the range. If the formula requests a column that is outside the range, correct the range or the index based on where the answer actually resides.
- Look for a literal
#REF!. If it appears inside the formula where a cell or range should be, replace that argument with the correct, existing reference. Changing the return index alone will not repair a missing table range. - Check neighboring formulas. If only some rows fail, compare their references with a working row. A relative table range may have shifted as the formula was filled down.
- Recalculate and verify the result. Test with a lookup value known to exist and confirm that the returned field is the intended one, not just that the error disappeared.
When a formula is copied down, lock a table range that should stay fixed. With lookup values in E2:E100, product codes in A2:A100, prices in C2:C100, and each formula entered on its corresponding row, the following formula keeps the table fixed while allowing E2 to change to E3, E4, and so on: =VLOOKUP(E2,$A$2:$C$100,3,FALSE). The dollar signs make the table range absolute; they do not fix an incorrect column number or restore deleted data.
Use exact match for ordinary lookups
For codes, names, and identifiers, exact matching is usually the appropriate choice. In VLOOKUP, the fourth argument FALSE requests an exact match. It does not prevent #REF!, but it avoids a separate class of surprising results associated with approximate matching.
Approximate matching uses TRUE or an omitted fourth argument. It is intended for ordered ranges and threshold lookups, and the first column generally needs to be sorted in ascending order for reliable results. If the goal is to find one exact product code, using FALSE makes that intent explicit. A missing exact value typically yields #N/A, not #REF!.
Prevent the error as a worksheet changes
VLOOKUP’s numeric return index can become out of date when a table is redesigned. A simple safeguard is to keep the lookup range and index aligned, then test formulas after inserting, deleting, or moving columns. If colleagues maintain the workbook, clear headers and a note describing the expected lookup and return fields can help prevent accidental edits.
Consider formatting the source data as an Excel table using Insert > Table. Table references can make formulas easier to read and can expand as rows are added, though a table does not make an invalid VLOOKUP column number valid. Check the formula after changing the table’s columns, and ensure the lookup column remains the leftmost column in the selected VLOOKUP range.
Absolute references are useful when copying a formula, but they solve only reference movement during copying. They do not protect a formula from every structural change or guarantee that the return index still points to the desired field. After modifying a source table, verify a few known results—including one near the beginning and one near the end of the data—before relying on the workbook.
When XLOOKUP may be a better choice
In Microsoft 365, XLOOKUP can specify the lookup column and return column separately, so it does not need a numeric return-column index. This avoids the particular mistake of asking VLOOKUP for a fourth column in a three-column range. XLOOKUP is available in Microsoft 365 and Excel 2021; it is not available in some older perpetual Excel versions.
With product codes in A2:A100, prices in C2:C100, and the code to find in E2, this formula returns the matching price or the text “Not found” if there is no match: =XLOOKUP(E2,A2:A100,C2:C100,"Not found"). In this example, a found code returns the corresponding value from column C. XLOOKUP also allows a return range to the left of the lookup range, unlike VLOOKUP, whose lookup column must be the leftmost column in its table range.
Changing functions is not required to fix a VLOOKUP error. If the workbook must work in an older Excel version, or existing formulas are already understood and maintained, correcting the range and index may be the simplest solution. Choose a replacement based on compatibility and how the workbook will be used, not just on the appearance of one error.
Related errors and fixes that do not solve #REF!
It is easy to try the wrong fix because lookup errors can look similar. #N/A usually points to a value not found in an exact-match lookup, while #REF! points to an invalid reference. #VALUE! can result from an invalid argument type; it is not the same as requesting a return column beyond the table’s width. Confirm the displayed error before changing the formula.
Wrapping a formula in IFERROR can replace an error with a message, but it does not repair the underlying reference. For example, with the lookup value in E2 and the intended table in A2:C100, this formula displays “Check lookup” for any error, including #REF!: =IFERROR(VLOOKUP(E2,A2:C100,4,FALSE),"Check lookup"). Because the index is invalid, the message hides a formula defect rather than returning a valid price. Fix the reference first; use error-handling formulas only when the alternative result is deliberate.
Frequently Asked Questions
Why does VLOOKUP return #REF! when the value exists?
The lookup value can exist while the return reference is invalid. Check whether the third argument asks for a column beyond the width of the selected table, and confirm that the table range still points to valid cells. A found value cannot compensate for a broken return-column reference.
Does a missing lookup value cause #REF!?
Usually no. With exact-match VLOOKUP, a value absent from the first column generally produces #N/A. A #REF! error more often means the range or return-column index is invalid.
How do I count VLOOKUP columns correctly?
Count from the first column in the table_array, starting at 1. In B2:D100, B is 1, C is 2, and D is 3. The index is not the worksheet’s column number.
Will IFERROR fix a VLOOKUP #REF! error?
No. IFERROR can display a replacement value instead of an error, but the underlying lookup remains invalid. Correct the table range or index first so the formula can return the intended field.
Can I use XLOOKUP instead of VLOOKUP?
Yes, if the workbook will be opened in Microsoft 365 or Excel 2021 or later. XLOOKUP uses separate lookup and return ranges, avoiding VLOOKUP’s numeric return-column index. For older Excel versions, retain or replace VLOOKUP with a compatible method.
Related
- Microsoft Excel Insert Page Break: A Practical Guide
- Microsoft Excel Heat Maps: How to Create and Read Them
- Microsoft Excel: How to Remove Duplicate Rows Safely
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Errors & fixes
- Word Mail Merge From Excel: Fix Number FormattingIn Word for Microsoft 365 on Windows, format a merge field with a numeric picture switch—for example, {…
- Excel RATE #NUM Error: Causes, Examples, and Fixes ExplainedExcel’s RATE function returns #NUM! when it cannot find a rate that satisfies the cash-flow inputs, often because…
- Excel Filter Not Working? Fix Common ProblemsIf Excel’s Filter option is not working, first select a cell in the full data range and choose…
- Excel Page Break Won’t Remove? How to Fix ItIf an Excel page break won’t remove, first check whether it is a manual break or an automatic…
- VLOOKUP Not Working? Fix Common Excel Lookup ErrorsIf VLOOKUP is not working properly, start by using an exact match with FALSE, checking that the lookup…
- Excel Not Working? Fixes for Common ProblemsIf Excel is not working, first save a copy of your workbook if you can, close and reopen…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.