A VLOOKUP #REF! error means the formula contains an invalid cell or range reference. The most common cause is a column number that asks VLOOKUP to return a column outside the selected table range; correcting that number or repairing the broken reference usually fixes the error.
What #REF! Means in VLOOKUP
#REF! is Excel’s reference error. It signals that a formula points to a cell or range that Excel cannot use, rather than simply failing to find a matching value. In VLOOKUP, the invalid reference may be in the table range, the return-column number, or another part of the formula. A referenced cell can also contain an error that flows into the lookup result.
This distinction matters when troubleshooting. If an exact-match VLOOKUP cannot find the requested item in the first column of its table, the usual result is #N/A, not #REF!. If the formula shows #REF!, check the references and arguments before changing the data or assuming that the lookup value is missing.
The error can appear after a formula is edited, a referenced row or column is deleted, a range is changed, or a copied formula picks up an unintended reference. Excel may adjust references automatically when cells are inserted or deleted, so not every structural change causes an error. The key is to inspect what the formula actually contains now.
How VLOOKUP Builds a Result
VLOOKUP searches for a value in the first, leftmost column of a table range, then returns a value from another column in the same row. Its syntax is VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup]). The third argument, col_index_num, is a position counted from the left edge of table_array, not a worksheet column letter or a column number on the sheet.
For example, with product IDs in A2:A5, product names in B2:B5, prices in C2:C5, and the ID to search for in E2, the following formula returns the price. The assumed layout is IDs in A2:A5, names in B2:B5, prices in C2:C5, and the lookup ID in E2:
=VLOOKUP(E2,$A$2:$C$5,3,FALSE)
The result comes from the third column of the selected range: column C. The dollar signs keep the table range fixed if the formula is copied to other cells. FALSE requests an exact match, which is generally the safer choice for IDs, names, and other discrete lookup keys.
VLOOKUP’s optional final argument can be TRUE or omitted to request an approximate match. Approximate matching has specific requirements, including a lookup column sorted in ascending order. For ordinary record lookups, using FALSE avoids accidental approximate results and makes the intended match rule explicit.
Common Causes of a #REF! Error
- The return-column number is too large. If the table range has three columns but the formula requests column 4, that requested column does not exist within the range and VLOOKUP returns
#REF!. - A referenced column or cell was removed. Deleting a column involved in a formula can leave a broken reference, depending on what was deleted and how the formula’s range was defined. Excel may adjust some ranges automatically, so inspect the formula rather than relying on the fact that a deletion occurred.
- The table range was changed or typed incorrectly. A manually edited range can include an invalid address or the literal
#REF!token. A range that is simply too narrow is more likely to cause a bad column index than a broken reference, but both should be checked. - A copied formula has an unsuitable reference. Relative references move when a formula is filled down or across. If the table range was not locked with dollar signs, it may shift away from the intended data.
- A sheet or workbook reference is no longer valid. A formula that refers to a renamed or removed sheet, or to a workbook location that is no longer available, may contain a broken reference. Check any sheet names and external links shown in the formula.
- An error is being passed through. If the lookup value or a relevant referenced value is itself an error, the result may also display an error. Check the cells feeding the formula, not only the VLOOKUP expression.
How to Diagnose the Formula
Start by selecting the cell that displays #REF! and reading the formula in the formula bar. Look for a visible #REF! token, an unexpectedly short table range, a column number larger than the range width, or a sheet or workbook reference that no longer exists. If the formula is long, click into it and inspect each argument separated by commas.
Then compare the requested column number with the actual width of the selected range. Count from the range’s left edge. For example, A:C is three columns wide: A is 1, B is 2, and C is 3. If the formula asks for 4, it is asking for a fourth column that is not included. A worksheet column such as C being column 3 is only coincidental here; if the table begins in D, the first column in the range is still position 1.
Check whether the formula’s table range includes the lookup column and the desired return column. VLOOKUP searches only the range’s first column, and its return column must be inside that same range and to the right of the lookup column. Also verify that the lookup value is the one you intended to reference. This check can expose a shifted reference even when it is not the direct source of #REF!.
For a large workbook, use Excel’s formula auditing tools to follow dependencies. On Windows, select the formula cell and choose Formulas > Formula Auditing > Trace Precedents to see cells that feed it. Formulas > Formula Auditing > Evaluate Formula can step through parts of a formula. The ribbon names are similar in Excel for Mac, though their placement can vary with the window layout. These tools help distinguish a broken address from an error in an input cell.
Fix the Column-Index Problem
If the third argument is larger than the table range’s width, change it to the position of the desired return column within that range. Suppose IDs are in A2:A5, names in B2:B5, prices in C2:C5, and the lookup ID is in E2. This formula requests column 4 from a three-column range, so it returns #REF!. Its assumed layout is IDs in A2:A5, names in B2:B5, prices in C2:C5, and the lookup ID in E2:
=VLOOKUP(E2,$A$2:$C$5,4,FALSE)
To return the price, change the column index to 3. With the same layout, the corrected formula returns the price on the row whose ID matches E2:
=VLOOKUP(E2,$A$2:$C$5,3,FALSE)
Do not change the number merely to make the error disappear; confirm that it points to the intended field. If the desired field is in column D, expand the table range to include D and use the correct position from the range’s left edge. For a range A:D, column D is position 4. If the desired return field is to the left of the lookup column, VLOOKUP cannot retrieve it with that table layout. Reorder the range or use another lookup approach.
Repair Broken References and Copied Formulas
If the formula visibly contains #REF! in its table range or another reference, replace that token with the correct address. For instance, if the data now occupies A2:C100, select that real range rather than guessing from the old formula. If a worksheet was renamed, choose the intended sheet and rebuild the reference using the current tab name. When possible, select the range with the mouse while editing the formula; this reduces typing mistakes.
When copying formulas, decide which references should move and which should stay fixed. A range written as A2:C5 is relative, so it can shift when filled down. The example range $A$2:$C$5 is absolute and remains fixed. In Excel for Microsoft 365 on Windows, press F4 while editing a cell reference to cycle through relative and absolute reference styles. On a Mac, the keyboard equivalent depends on the keyboard and Excel settings; if the shortcut does not work, add the dollar signs directly in the formula bar.
For a broken external reference, confirm that the source workbook and worksheet still exist and that the formula points to the intended location. Repairing an external path may require opening the source file or using Excel’s workbook link controls, depending on how the link was created. Do not replace a reference with a nearby range until you have confirmed that it contains the correct lookup keys and return values.
Prevent the Error as Data Changes
Make lookup formulas resilient to routine edits. Use absolute references for fixed ranges, and consider converting a changing data block into an Excel Table: select the data, then choose Insert > Table and confirm whether the table has headers. Tables expand as rows are added, which can help keep new records inside the lookup source. They do not, by themselves, correct an invalid column index or change VLOOKUP’s left-to-right limitation.
Review formulas after deleting or moving columns, especially when many formulas depend on the affected area. Keep the lookup key and the return field clearly labeled so that the column index can be checked against the table layout. If a workbook has many similar formulas, compare a few results after structural edits instead of assuming every copied formula still points to the intended fields.
For a recurring process, document the lookup range and what each column index means. A note such as “3 = unit price in the selected A:C range” can save time when someone changes the data layout later. It is also useful to test a known key with a known result after modifying the source table. This checks both the reference and the matching behavior.
When to Use a Different Lookup Method
VLOOKUP is useful when the lookup key is in the first column of a range and the result is to its right. However, its numeric column index can become fragile if columns are inserted or rearranged: the formula may still be syntactically valid while returning a different field than intended. That is a separate risk from #REF!, but it is one reason people consider alternatives.
In Microsoft 365, XLOOKUP can specify the lookup column and return column separately, making the intended fields easier to see. With IDs in A2:A5, prices in C2:C5, and the lookup ID in E2, the following formula returns the corresponding price when there is a match. Its assumed layout is IDs in A2:A5, prices in C2:C5, and the lookup ID in E2:
=XLOOKUP(E2,A2:A5,C2:C5)
XLOOKUP is available in Microsoft 365 and Excel 2021 or later, but not in older perpetual releases such as Excel 2019. INDEX and MATCH are another option in older versions and can return values from either side of the lookup column, though their combined syntax may be less familiar. No lookup function can return a meaningful result from a range that has genuinely been deleted or from a source that no longer contains the needed data; the underlying reference still needs repair.
Frequently Asked Questions
Why does VLOOKUP return #REF! instead of #N/A?#REF! generally points to an invalid reference or a return-column index outside the selected range. #N/A usually means an exact lookup did not find the requested value. Check the formula’s range and third argument first, then check whether the key exists.
How do I count the VLOOKUP column number?
Count columns from the left edge of the table range, starting at 1. If the range is B:E, B is 1 and E is 4, regardless of the columns’ worksheet letters. The chosen number must not exceed the number of columns in the range.
Can deleting a column cause a VLOOKUP #REF! error?
Yes, if deletion leaves a formula with a broken reference. Excel may automatically adjust some formulas and ranges, so deletion does not always create the error. Inspect the formula bar and confirm the current source range after changing the worksheet structure.
Will IFERROR fix a VLOOKUP #REF! error?
IFERROR can hide an error by replacing it with a chosen value, but it does not repair the invalid reference. Use it only when a fallback display is appropriate and you have handled the cause; otherwise, it can conceal a broken formula that should be corrected.
Why does VLOOKUP still fail after I fix the column number?
The table range, sheet reference, lookup input, or source data may still be wrong. If the remaining result is #N/A, check for an exact match and differences such as extra spaces or numbers stored as text. If it remains #REF!, inspect every argument and any referenced cells for a broken address.
Related
- Excel Data Validation Methods: Rules, Lists, and Tips
- Excel Data Validation List from a Table: How to Set It Up
- Data Validation in Word: Build Forms and Drop-Down Lists
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Errors & fixes
- XLOOKUP Not Working With Text? Fix the MatchYes—XLOOKUP can look up text, and it uses an exact match by default. When it fails, the usual…
- Why Am I Getting a #REF! Error in Excel?You are getting a #REF! error because an Excel formula contains a reference that is no longer valid,…
- Excel COUNTIFS Date Range Not Working? Fix the CriteriaIf Excel COUNTIFS is not counting dates in a range, first make sure the cells contain real Excel…
- Excel Ctrl+F Not Working? How to Fix Excel Find IssuesIf Ctrl+F is not working in Excel, first click a worksheet cell and press Ctrl+F again; on Mac,…
- Excel IF Function Not Working? Fix Common Formula ErrorsIf Excel’s IF function is not working, first check that the formula starts with =IF(, its test compares…
- Circular Reference Not Working in Excel? Fix ItA circular reference in Excel will not calculate as expected if iterative calculation is off, the formula does…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.