VLOOKUP not finding data that is present

drgnrider

New Member
Trying to use one worksheet as data and do calculations on another, thus need to pull specific data from the data sheet to my calculations sheet.

Using the formula:
=VLOOKUP(C4&"",'List of Lists by name'!D:D,3,FALSE)

This returns the #NA error, despite my confirming the data is located in row D.

- Both C4 and row D are formatted as text but contain number strings with dashes, (i.e.: 100-41-4).
- It finds the correct data in C4 but not on worksheet "List of Lists by name" in row D. When using the "Show calculation steps", the result of the row D search is shown as 0.
- I added the -&""- after C4 and even tried after D:D to see if it would find the numbers. This suggestion from another page that noted this command has an issue with working with numbers vs. text
- Used this formula on the "List of Lists by name" worksheet, but it also returned #NA , even after replacing -C4&""- with the data copied from the row D cell
- The "List of Lists by name" worksheet is an EXCEL worksheet downloaded from a U.S. Government website, thus not of my creation.

1) Is my formula correct?
2) What could be causing the VLOOKUP and MATCH commands from not finding the data even when searching directly on the worksheet and copying the target data?
3) Is there a limit as to how many rows/cells that VLOOKUP can go through?
 

kweaver

Well-known Member
Welcome.

You shouldn't need the &"" ... Does your D column on the other sheet have add'l spaces or non-printable characters?

I would probably help if you could post your data somewhere.
 
Last edited:

DanteAmor

Well-known Member
You need to put the third column:


=VLOOKUP(C4,'List of Lists by name'!D:F,3,FALSE)
 
Last edited:

steve the fish

Well-known Member
Your formula is wrong but if its showing na error then its not finding the lookup value in column D of the sheet. Use CTRL-F to confirm the value is there. Make sure entire cell contents is checked.
 

kweaver

Well-known Member
From which sheet are you running this vlookup? Where's C4? None of the sheets have anything in C4.
 
Last edited:

kweaver

Well-known Member
On the "List..." sheet, I put this in the K6:K1804 column: =trim(clean(D6)) and filled down.

Then, in C4 on that sheet, I entered: 108-05-4 and in D4 I put: =INDEX(F6:F1804,MATCH(C4,K5:K1804,0),1) and found the result of 5,000 without an error.
So, there are probably unprintable characters in your D column that need to be removed to search properly for a CAS code.
 
Last edited:

drgnrider

New Member
Ran TRIM and CLEAN again, no change.
@DanteAmor: Thank you for the link. I was able to confirm there is an extra character on the end, (CHAR says 'ASCII 32'), but was unable to use the...
=TRIM(SUBSTITUTE(SUBSTITUTE(D:D,CHAR(32)," "),CHAR(160)," "))
... to clear this trailing character.

To get the correct data for one line, I deleted the "extra character" and adjusted the formula to:
=VLOOKUP(C4,'List of Lists by name'!D:G,4,FALSE)

Lastly, did a global find/replace on 'ASCII 32' to delete this character, that seems to have fixed the problem.

Thank you everyone for your assistance.
 

Some videos you may like

This Week's Hot Topics

  • Get External Data (long shot question!)
    This is likely a long shot but I am wondering if it is at all possible for Excel to somehow 'change' the contents of a URL that is being linked to...
  • Importing multiple excel files into one spreadsheet
    Hi, I'm trying to import multiple excel files (with the same format into a single spreadsheet) so that each day's file is listed underneath the...
  • Cell Formatting
    Good Morning, I need to format a few different cells in the following manners: A1 has to always add a colon (:) after whatever is typed in by a...
  • How to copy multiple rows using If
    Hi all, I'm very new to VBA and have written this simple code to copy certain cells if a certain cell within that row contains any data. I need...
  • Workbook_Change stopped working !
    I am working on an app to speed up & automate processing of Credit Cards statements. After data is input from a CSV file, it is presented to the...
  • VBA If statement
    Dear All, I have two dates, where I'd like a message box to pop, if the dates are between this criteria. [CODE] sDate1 = #10/1/2019#...
Top