[Fixed!] Excel VLOOKUP Not Working Due to Format (2 Solutions)

The sample dataset contains information from a store with the items’ codes, names, and sales.

Sample Dataset for VLOOKUP Not Working Due to Format

 

Due to format errors, the VLOOKUP function returns #N/A errors instead of results.


Problem 1 – VLOOKUP Not Working Due to Mismatch of Cell Formats

A difference in format between the lookup value and column value will result in this error. In this example we want to find the item name whose sales value is $20,000.

=VLOOKUP(F5,C5:D14,2,FALSE)

Excel VLOOKUP Not Working Due to Format

The formula is returning a #N/A error because the lookup value cell F5 is in Accounting format, but the lookup column values are in Text format.

Check this by selecting cells C5:C14 >> Home tab >> Number group >> Number Format box.

Check the Format of Following Cells

 

To solve this issue follow the steps below.

Steps:

  • Click on cells C5:C14.
  • Go to Data tab >> Data Tools group >> Text to Columns tool.

Access the Text to Columns Tool

  • The Convert Text to Columns Wizard window will appear.
  • Choose the Delimited option and click on the Next button.

Convert Text to Columns Wizard Step 1 Window

  • In the Convert Text to Columns Wizard, check on the option Tab from the Delimiters options.
  • Click on the Next button.

Convert Text to Columns Wizard Step 2 Window

  • Choose the General option from the Column data format pane and click on the Finish button.

Convert Text to Columns Wizard Window to Solve VLOOKUP Not Working Due to Format

All the data of C5:C14 cells will be converted from Text to General format. The VLOOKUP function should work properly now.

Solved VLOOKUP Not Working Due to Format Issue

Note:

You can change the format of the C5:C14 cells manually by using the Format Cells dialogue box, but you have to delete the values of all the cells, change the format and then put the values again manually one by one to make the VLOOKUP function work.


Problem 2 – Hidden Space/Characters

Another common cause of errors are hidden spaces or characters. This type of issue mainly happens with numbers.

In this example we want to find item names according to the item codes.

=VLOOKUP(F5,$B$5:$D$14,3,FALSE)

Excel VLOOKUP Not Working Due to Format

But, the formula is returning a #N/A error for some reason.

If you click on cell B9 where the relevant Item Code is, there is an apostrophe (‘) just before the actual item code. This apostrophe is not shown in the cell output, but it is converting the code’s format from Number to Text automatically.

Hidden Character Within Numbers

 

Steps:

  • Click on your formula cell (G5 here).
  • Add the TRIM function into cell F5 and cell range B5:D14 in the existing formula as below.
=VLOOKUP(TRIM(F5),TRIM($B$5:$D$14),3,FALSE)

 

Incorporating TRIM Function to Solve VLOOKUP Not Working Due to Format Issue

The issue has been resolved.


Download Practice Workbook

You can download our practice workbook from here for free!

 


Related Articles


<< Go Back to Issues with VLOOKUP | Excel VLOOKUP Function | Excel Functions | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Tanjim Reza
Tanjim Reza

Md. Tanjim Reza Tanim, a BUET graduate in Naval Architecture & Marine Engineering, contributed over one and a half years to the ExcelDemy project. As an Excel & VBA Content Developer, he authored 100+ articles and, as Team Leader, reviewed 150+ articles. Tanim, leading research, ensures top-notch content on MS Excel features, formulas, solutions, tips, and tricks. His expertise spans Microsoft Office Suites, Automating Finance Templates, VBA, Python, and Developing Excel Applications, showcasing a multifaceted commitment to the... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo