LBPLC
LBPLC

Reputation: 1571

VLOOKUP not giving expected results

I've used VLOOKUP plenty of times, but this has really stumped me. I have a VBA code that copies data from one workbook to another and then I'm trying to perform the VLOOKUP on the data that I've copied.

Here's an example of how the data I've copied is layed out in Sheet2:

5009 | Materials | Store Items

The table that has been copied is given the name "AutoList" for the range of the table (Theres a lot more than this obviously)

The table I'm trying to use the VLOOKUP on looks like this:

[VLOOKUP] | Materials | Z | X | C | V

The formula I am using is:

=VLOOKUP("Materials",AutoList,1,0)

I can't for the life of me figure out why I am getting #N/A as the result. If I remove the 0 on the end (for the logic), I end up with the last number in the AutoList table for every result as it's only doing a partial match.

Any help would be appreciated!

Upvotes: 0

Views: 110

Answers (2)

ejlj
ejlj

Reputation: 175

Is the "lookup_value" in the first column of your "table_array"...?

Upvotes: 1

JoshOfAllTrades
JoshOfAllTrades

Reputation: 532

According to Excel's help file vlookup looks, "for a value in the leftmost column of a table." Does AutoList define your range with "Materials" in the first column? If so, then shouldn't the result of your vlookup formula return "Materials"?

Upvotes: 1

Related Questions