Fix Excel VLOOKUP #N/A Errors with Text and Numbers
Question details
Find an exact VLOOKUP match when lookup values contain text, numbers, or both.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user is looking up a value in a table whose keys may contain letters or numbers.
- Observed behavior
- VLOOKUP returns #N/A when it cannot find a matching value, potentially because of different data types, spaces, or hidden characters.
Identify the lookup value, the table's lookup column, and the column containing the result. Check whether the keys are numeric values, numbers stored as text, or identifiers with meaningful leading zeros.
Clean both lookup values and use an exact match
Use helper columns to remove common hidden characters and compare keys as text.
In this example, column A contains the original keys, column B contains the results, and E2 contains the value to find. TRIM also collapses repeated internal spaces, so check that those spaces are not significant to your keys.
In C2, enter =TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160)," "))) and fill the formula down alongside the data in column A. This replaces nonbreaking spaces, removes common nonprinting characters, and trims spaces.
In D2, enter =B2 and fill the formula down. The lookup range C:D now starts with the cleaned keys and has the desired results in its second column.
In F2, enter =TRIM(CLEAN(SUBSTITUTE(E2,CHAR(160)," "))) to apply the same cleanup to the value you want to find.
In a result cell, enter =VLOOKUP(F2,C:D,2,FALSE). The FALSE argument requests an exact match in the first column of C:D.

Convert numeric text to numbers before the lookup
Use this approach when all lookup keys are genuinely numeric and leading zeros are not significant.
Clean and match lookup values in WPS Spreadsheets
Use WPS Spreadsheets to clean lookup keys in helper columns and run an exact-match VLOOKUP on an Excel workbook.
- 1. Open the workbook: Open WPS Spreadsheets and use Open to select your Excel workbook.
- 2. Clean the table keys: With keys in column A and results in column B, enter =TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160)," "))) in C2 and fill down. Enter =B2 in D2 and fill down to place the results beside the cleaned keys.
- 3. Clean the lookup value: If the lookup value is in E2, enter =TRIM(CLEAN(SUBSTITUTE(E2,CHAR(160)," "))) in F2.
- 4. Find the match: In a result cell, enter =VLOOKUP(F2,C:D,2,FALSE). Check that the cleaned key exists in column C if the formula still returns #N/A.

Frequently Asked Questions
Why does VLOOKUP return #N/A for a number that appears in the table?
The lookup value may be a number while the table key is stored as text. Use helper cells with VALUE for genuinely numeric keys, or clean both sides as text before using VLOOKUP.
Does Excel VLOOKUP distinguish between uppercase and lowercase letters?
No. An exact-match VLOOKUP with FALSE is not case-sensitive, so it treats name1 and NAME1 as a match.
Why does TRIM not remove every hidden space?
Excel TRIM does not remove nonbreaking spaces by itself. Replace them first with SUBSTITUTE(A2,CHAR(160)," "), then apply CLEAN and TRIM as needed.
Can VLOOKUP match an identifier containing letters and numbers?
Yes. Keep the identifier as text on both sides, clean unwanted spaces or hidden characters, and use FALSE as the final argument, such as =VLOOKUP(F2,C:D,2,FALSE).
What if the formula still returns #N/A after cleaning?
Check that the cleaned lookup value exists in the first column of the selected table range. Also verify that significant characters, including leading zeros, match on both sides.




