How to Fix VLOOKUP Errors with Right-Aligned Values in Excel
Question details
The user needs to fix a VLOOKUP #N/A error occurring because lookup values and source array data have mismatched data types, even though the values appear visually identical and right-aligned.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Using the VLOOKUP function to retrieve data from another table or sheet where the lookup key formatting differs from the source table.
- Observed behavior
- VLOOKUP returns an error (#N/A) because the lookup value's data type (e.g., number) does not match the lookup array's data type (e.g., text), despite both looking identical on screen.
Before modifying your formulas, confirm whether your right-aligned data is actually formatted as a number, or if it is text that has been manually aligned to the right. You can use the =ISTEXT() or =ISNUMBER() functions to quickly check the true data type of a cell.
Use the TEXT Function to Match Data Types
Wrap your lookup value in the TEXT function within the VLOOKUP formula to force the spreadsheet to treat the number as text, matching the source data type.
The most common cause of VLOOKUP failure is a data type mismatch. If your source table stores IDs or codes as text, but your lookup value is a standard number, VLOOKUP will not recognize them as a match. The TEXT function bridges this gap effortlessly.
Click on the cell where you want the VLOOKUP result to appear.
Edit your existing VLOOKUP formula to include the TEXT function around your lookup value. Type =VLOOKUP(TEXT(C9,"General"),'Table Export'!$E$2:$W$234,8,FALSE).
Press Enter to apply the formula. If the result is correct, click and drag the fill handle at the bottom-right corner of the cell to apply the updated formula to the rest of your column.

Remove Hidden Spaces with TRIM and CLEAN
If converting to text does not resolve the issue, hidden spaces or non-printable characters might be preventing an exact match.
Standardize Formatting using Text to Columns
Use the Text to Columns feature to batch-convert an entire column of text-formatted numbers back into actual numbers.
Fix VLOOKUP Errors Instantly with WPS Spreadsheet
WPS Spreadsheet provides robust formula auditing tools and built-in error checking to help you easily spot and fix formatting mismatches in VLOOKUP, ensuring your data analysis is accurate and hassle-free.
- 1. Open your file: Launch WPS Spreadsheet and open the document containing your VLOOKUP error.
- 2. Locate the error: Click on the cell displaying the #N/A error and look for the yellow warning triangle indicating a format issue.
- 3. Use Error Checking: Navigate to the 'Formulas' tab and use the 'Error Checking' tool to trace the mismatch.
- 4. Apply conversion functions: Seamlessly apply the TEXT or VALUE function within your formula to align data types and get accurate results.

Frequently Asked Questions
Why does my VLOOKUP return #N/A even when the exact value is there?
This usually happens due to a data type mismatch. One table might store the value as a number, while the other stores it as text. Even if they look identical visually, VLOOKUP sees them as different entities and fails to find a match.
Does cell alignment affect VLOOKUP results?
Cell alignment itself (left, right, center) does not affect VLOOKUP formulas. However, by default, spreadsheets align text to the left and numbers to the right. A right-aligned value might lead you to believe it is a number, but it could be manually right-aligned text.
How can I convert a column of numbers formatted as text back to numbers?
Select the column, click the yellow warning icon that appears next to the selection, and choose 'Convert to Number'. Alternatively, you can type '1' in an empty cell, copy it, select your data, and use Paste Special > Multiply.
Can I use the VALUE function instead of TEXT?
Yes. If your lookup value is formatted as text but your lookup array contains standard numbers, you can wrap your lookup value in the VALUE function to convert it into a number. For example: =VLOOKUP(VALUE(A2), Table, 2, FALSE).




