How to Fix Excel VLOOKUP Returning #N/A for Identical Values
Question details
The user's VLOOKUP formula is returning an #N/A error despite the lookup values appearing identical to the source data.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Using the VLOOKUP function to match imported data that might contain hidden formatting differences or non-printing characters.
- Observed behavior
- The VLOOKUP formula fails to find a match and returns an #N/A error because invisible characters or trailing spaces cause a mismatch.
Verify that both your lookup values and your source data column share the exact same data type, ensuring numbers aren't accidentally stored as text.
Use TRIM and CLEAN Functions to Remove Hidden Characters
Remove invisible non-printing characters and extra spaces from imported data that cause VLOOKUP to fail.
When importing data from external databases or websites, hidden characters or trailing spaces are often included. Excel treats 'Apple ' and 'Apple' as completely different values, resulting in an #N/A error. The CLEAN function removes non-printing characters, while TRIM removes extra spaces.
Right-click the column letter next to your lookup values or source data and select 'Insert' to create a new blank column.
In the first cell of the new column, enter the formula =TRIM(CLEAN(A2)) (assuming A2 contains your original uncleaned data) and press Enter.
Click the cell with the formula, then double-click the small square fill handle in the bottom-right corner to apply it to the entire dataset.
Select the newly cleaned column, press Ctrl+C to copy it, right-click the original data column, select 'Paste Special', and choose 'Values' to overwrite the uncleaned data.

Convert Text to Numbers Using Text to Columns
Fix mismatches caused by numbers being stored as text in either the lookup value or the source array.
Clean Data and Run VLOOKUP Seamlessly in WPS Spreadsheet
WPS Spreadsheet offers powerful data handling capabilities that are highly compatible with Microsoft Excel. You can easily use TRIM, CLEAN, and VLOOKUP functions to process your imported datasets without errors.
- 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your workbook containing the VLOOKUP #N/A error.
- 2. Clean the data: Use the =TRIM(CLEAN()) formula in an adjacent helper column to instantly strip away any hidden formatting or spaces.
- 3. Apply VLOOKUP: Ensure your VLOOKUP formula points to the newly cleaned data range to accurately retrieve your matched values.

Frequently Asked Questions
What does the #N/A error mean in a VLOOKUP formula?
The #N/A (Not Available) error indicates that the spreadsheet application cannot find an exact match for your lookup value within the first column of the specified source array.
How do I find invisible characters in my Excel cells?
You can use the LEN function (e.g., =LEN(A2)) to count the total number of characters in a cell. If the count is higher than the visible characters, it confirms there are hidden spaces or non-printing characters present.
Is there an alternative way to make VLOOKUP ignore hidden spaces without cleaning the data?
While data cleaning is recommended, you can sometimes bypass minor trailing or leading spaces by using wildcards in your lookup formula. For example, changing your lookup value reference to "*"&A2&"*" will search for the value anywhere within the cell, ignoring surrounding spaces.
Why does VLOOKUP fail even after using TRIM and CLEAN?
TRIM and CLEAN do not remove all non-breaking spaces (specifically ASCII character 160, often found in web data). To remove these, you need to use the SUBSTITUTE function: =TRIM(CLEAN(SUBSTITUTE(A2, CHAR(160), " "))).




