VLOOKUP can fail even when a value appears in the table because Excel may be comparing different underlying values, searching the wrong column, or using approximate-match mode. Start by using an exact-match formula with FALSE, then check that the lookup value is in the first column of the selected range and that both values have the same type and characters.
How VLOOKUP searches for a value
VLOOKUP searches down the first column of a range for the lookup value, then returns a value from another column in the same row. Its column number is counted from the left edge of the selected range, not from the worksheet’s column letters. That design explains several common surprises: it cannot search to the left, and selecting the wrong range can make it search a column that does not contain the key.
For example, with product IDs in A2:A5, product names in B2:B5, and the ID to find in E2, this formula searches column A and returns the matching name from column B:
With product IDs in A2:A5, names in B2:B5, and the lookup ID in E2, use =VLOOKUP(E2,$A$2:$B$5,2,FALSE). If E2 contains 1042 and A3 is 1042 with North in B3, the result is North.
The final argument matters. FALSE requests an exact match. If you omit that argument, VLOOKUP uses approximate matching, which can return an unexpected row or an error if the first column is not sorted appropriately. For ordinary lookups such as names, order numbers, or product codes, explicitly include FALSE.
Check match mode first
Approximate-match mode is one of the first things to investigate when a result looks wrong rather than simply missing. With approximate matching, Excel looks for an exact value or, if it cannot find one, a nearby value according to the ordering of the first column. The first column should be sorted in ascending order for predictable approximate results. If it is not, the answer may be unreliable.
For an exact lookup, the fourth argument should be FALSE (or its equivalent, 0). Do not rely on the default, even if the table happens to be sorted today: a later sort or new row can change what an approximate lookup returns. Also distinguish a missing result from a wrong result. A formula returning a value is not proof that it found the exact row if the formula is using approximate mode.
Numbers stored as text are not numbers
A cell can display 1234 while containing the text string “1234,” and another cell can contain the numeric value 1234. They look alike, but their underlying types differ. An exact lookup can fail when the lookup value is numeric and the key in the table is text, or the other way around. Formatting a cell to look like a number does not necessarily convert its stored value.
Check the source and lookup cells for clues such as a green error indicator, or test the type in a spare cell. With the value to inspect in A2, =ISTEXT(A2) returns TRUE if it is text. With the value to inspect in A2, =ISNUMBER(A2) returns TRUE if it is numeric. These checks help identify a mismatch; they do not change the source value.
If the table’s keys are genuinely numeric and the lookup input is numeric text, you can convert the input in the formula. With numeric keys in A2:A5, results in B2:B5, and text digits in E2, use =VLOOKUP(VALUE(E2),$A$2:$B$5,2,FALSE). If E2 contains the text 1042 and A3 contains the number 1042, the formula finds row 3. This conversion is not suitable for codes where leading zeros matter: converting the text “0017” to a number produces 17, which may not be the same identifier.
For a lasting fix, make the key column and lookup input consistent in the source data. Excel’s Data > Text to Columns workflow can convert text-formatted numbers in a selected column; inspect the result before relying on it, especially when the values are codes or contain leading zeros.
Look for spaces and invisible characters
Text that appears identical may contain a leading space, a trailing space, a line break, or a nonbreaking space copied from a web page. For instance, “North” and “North ” look almost the same on screen but are different strings. A normal space can often be removed with TRIM, while CLEAN removes certain nonprinting characters. Neither function removes every possible Unicode character, so copied data may need additional investigation.
A common cleanup formula replaces nonbreaking spaces with regular spaces, removes nonprinting characters, and trims extra ordinary spaces. With the text to clean in A2, use =TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160)," "))). If A2 contains a name followed by a nonbreaking space, the result is the cleaned name without that trailing space. Put cleaned keys in a helper column and make the lookup formula search that helper column; cleaning only the lookup input will not help if the table keys remain uncleaned.
Be careful when applying cleanup to identifiers. TRIM reduces repeated ordinary spaces as well as removing leading and trailing ones, which may alter data if internal spacing is meaningful. Keep an original copy of the values and compare a few cleaned results before replacing source data.
Verify the lookup range and column number
VLOOKUP only searches the leftmost column of the range you specify. If IDs are in column B but the formula uses C:D, it will search column C, even if the ID is plainly visible in B. Adjust the range so the key column is first. If you need to return a value from a column to the left of the key, VLOOKUP cannot do that with its usual arrangement; use a different lookup method or restructure the data.
The third argument counts columns inside the range. If the range is B2:D100, then B is column 1, C is 2, and D is 3. A column number larger than the width of the range produces #REF!. A valid but incorrect number can return a value from the wrong field, so confirm the intended return column rather than assuming the worksheet’s column number is the right argument.
Also check that the range has not shifted when the formula was copied down. Without dollar signs, a reference such as A2:B100 can move to A3:B101 in the next row. For a fixed table, absolute references such as $A$2:$B$100 keep the range in place while the lookup cell changes. In Microsoft 365 for Windows, you can inspect formulas directly or use Formulas > Evaluate Formula to step through how Excel calculates one.
Diagnose the error or unexpected result
The displayed result often narrows down the cause. #N/A generally means an exact match was not found in the first column of the selected range, though a type or character mismatch can make an apparently present value count as absent. #REF! commonly points to an invalid column index or a broken reference. A plausible but incorrect answer suggests checking approximate-match mode, the range, and the return-column number.
Use a short, repeatable check rather than changing several things at once:
- Confirm that the lookup value is in the leftmost column of the selected table range.
- Set the fourth argument to
FALSEand confirm that the range includes the intended row. - Compare the underlying values: number versus text, leading zeros, spaces, and nonprinting characters.
- Check the third argument against the number of columns in the range, counting from its left edge.
- Inspect absolute and relative references, especially after copying the formula to another row.
- Check for duplicate keys if the formula returns a match but the returned record is not the one you expected.
When a formula is long or nested, select the formula cell and choose Formulas > Evaluate Formula. Excel shows the calculation in stages, which can reveal whether the lookup input or the table reference is different from what you intended.
Duplicates, wildcards, and other gotchas
VLOOKUP returns the first matching row it encounters when the lookup column contains duplicates. If two customers share a name, for example, a name-based lookup may return the first customer’s record, not the record you meant. Use a unique key such as a customer ID, or build a key that uniquely identifies the row. An exact match does not make a non-unique key unambiguous.
Text lookups with FALSE can also interpret the wildcard characters * and ? in the lookup value. An asterisk can stand for any sequence of characters, and a question mark can stand for one character. If the value you need to match contains one of these characters literally, precede it with a tilde in the lookup value. This is uncommon for ordinary names and IDs but relevant when searching filenames or other text that includes wildcard characters.
VLOOKUP’s text matching is not case-sensitive, so it will not distinguish “ab12” from “AB12.” If case is part of the identifier, VLOOKUP alone is not sufficient to enforce that distinction. Decide whether the key should be case-sensitive before choosing a lookup approach.
When another lookup method may be better
If the key is not the first column, or if the return column is to the left, XLOOKUP can be more flexible in Microsoft 365. For a key in B2:B100, a return value in A2:A100, and a lookup value in E2, use =XLOOKUP(E2,B2:B100,A2:A100,"Not found",0). If E2 matches an entry in B2:B100, this returns the corresponding value from column A; if there is no match, it returns Not found. XLOOKUP is available in Microsoft 365 and Excel 2021 or later, but not in older perpetual versions such as Excel 2019.
Switching functions does not automatically repair dirty or inconsistent data. XLOOKUP also needs comparable values and a correctly chosen lookup range. If you share a workbook with people using older Excel versions, check compatibility before replacing VLOOKUP. For a simple table where the key is already the first column, VLOOKUP remains a practical and widely supported choice.
Frequently Asked Questions
Why does VLOOKUP return #N/A when the value is visible?
The visible value may differ underneath because one is text and the other is numeric, or because of an extra space or nonprinting character. Also confirm that the value is in the first column of the lookup range and that the formula uses FALSE for an exact match.
Does VLOOKUP need the first column to be sorted?
Not for an exact-match lookup using FALSE. Approximate matching uses a different rule and requires the lookup column to be sorted in ascending order for predictable results.
Why does VLOOKUP return the wrong row?
Check whether the formula is using approximate matching, whether the third argument points to the intended return column, and whether the key appears more than once. VLOOKUP returns the first matching row, so duplicate keys can produce a technically valid but unintended result.
Can VLOOKUP search to the left?
No. It searches the first column of its selected range and returns a value from a column to the right. Put the key column first in the range or use a method such as XLOOKUP that can return a value from a column on either side.
Will changing the cell format fix a text-versus-number mismatch?
Usually not. Number formatting changes how a value is displayed, but it does not necessarily convert text to a number. Convert the underlying data carefully, and preserve leading zeros when they are meaningful parts of a code.
Related
- Excel Key to Delete a Row: Shortcut and Options
- Excel Find Shortcut: How to Search a Worksheet
- Excel CSV vs ODS: Which Export Format to Choose
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Errors & fixes
- Hyperlink Not Working in PowerPoint? Fix the Common CausesIf a hyperlink is not working in PowerPoint, first test it in Slide Show view: in editing view,…
- Excel Merged Cells Not Showing in Filter? Fix the DataExcel filters do not treat a vertically merged cell as though its value were repeated in every row:…
- SUMIF Function Not Working in Excel? Fix Common ErrorsIf SUMIF is returning zero or the wrong total, first check that the criteria range and sum range…
- Excel Regression P-Value: Fixing the #NUM! ErrorIn Excel, a regression p-value showing #NUM! usually means the test cannot be evaluated with the statistic or…
- Excel CLEAN Function Not Working? Fix Hidden CharactersIf Excel’s CLEAN function seems not to work, the usual reason is that the character is not one…
- Excel Column Is a Number Instead of a Letter? Fix ItIf Excel shows column headings as 1, 2, 3 instead of A, B, C, turn off R1C1 reference…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.