Function Problems

How to Fix VLOOKUP Errors with Right-Aligned Values in Excel

Huda QurayshiHuda Qurayshi Nov 11, 2026 868 views

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.

How to Fix VLOOKUP Errors with Right-Aligned Values in Excel
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 you start

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.

Solution 1Recommended

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.

1
Select the target cell

Click on the cell where you want the VLOOKUP result to appear.

2
Modify the VLOOKUP formula

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).

3
Apply and drag

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.

Use the TEXT Function to Match Data Types
Quick Tip: Using "General" as the format text works for most standard numbers, but you can also use "0" if your numbers have a specific digit length or leading zeros.
Powerful Spreadsheet Tool

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. 1. Open your file: Launch WPS Spreadsheet and open the document containing your VLOOKUP error.
  2. 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. 3. Use Error Checking: Navigate to the 'Formulas' tab and use the 'Error Checking' tool to trace the mismatch.
  4. 4. Apply conversion functions: Seamlessly apply the TEXT or VALUE function within your formula to align data types and get accurate results.
Fully compatible with Microsoft Excel formulas, including VLOOKUP, XLOOKUP, and TEXT.Built-in smart error checking highlights data type mismatches instantly with warning icons.Free, lightweight, and supports all major spreadsheet formats (.xlsx, .xls, .csv).Familiar user interface requires no learning curve when migrating from other office suites.
microsoft office alternative - wps office

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).