简体   繁体   中英

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!

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"?

“ lookup_value”是否在“ table_array”的第一列中?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM