简体   繁体   English

VLOOKUP没有给出预期的结果

[英]VLOOKUP not giving expected results

I've used VLOOKUP plenty of times, but this has really stumped me. 我已经使用VLOOKUP很多次,但这确实让我感到困惑。 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. 我有一个VBA代码,可以将数据从一个工作簿复制到另一个工作簿,然后尝试对复制的数据执行VLOOKUP

Here's an example of how the data I've copied is layed out in Sheet2: 这是一个有关如何在Sheet2中布置我复制的数据的示例:

5009 | 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) 对于该表的范围,已复制的表的名称为“ AutoList”(显然还有很多)

The table I'm trying to use the VLOOKUP on looks like this: 我正在尝试使用VLOOKUP的表如下所示:

[ VLOOKUP ] | [ VLOOKUP ] | Materials | 材料 Z | Z | X | X | C | C | V 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. 我一生无法弄清楚为什么我得到#N / A结果。 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. 如果我在逻辑上将最后的0删除,我将得到每个结果在AutoList表中的最后一个数字,因为它只是部分匹配。

Any help would be appreciated! 任何帮助,将不胜感激!

According to Excel's help file vlookup looks, "for a value in the leftmost column of a table." 根据Excel的帮助文件,vlookup看起来“在表的最左列中有一个值”。 Does AutoList define your range with "Materials" in the first column? AutoList是否在第一列中使用“材料”定义您的范围? If so, then shouldn't the result of your vlookup formula return "Materials"? 如果是这样,那么您的vlookup公式的结果是否应该返回“ Materials”?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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