匹配不同文件中的单元格,并返回另一个的值

我有两个文件,我需要查找单元格,并确保它们匹配并返回另一个的实际值。 当我使用下面公布的公式只是返回一个True或False,我需要单元格的实际值…

(2).xls]入场'!$ W:$ W,AND(K:K ='[HW入库货件信息十月二十一日(二).xls] Inbound'!$ X:$ X,VLOOKUP('[HW inbound shipping info 21 Oct(2).xls] Inbound'!$ U:$ U,1,0)))

正如我理解你的公式一样,几乎每个函数和括号都被错误地使用了。 对不起:-) AND处于错误位置, IF没有有用的参数, VLOOKUP根本没有意义。 尝试使用这个公式:

 =IF(AND(V:V='[HW inbound shipment info 21 Oct (2).xls]Inbound'!$W:$W,K:K='[HW inbound shipment info 21 Oct (2).xls]Inbound'!$X:$X),"success","failed")) 

我不确定是否正确,因为我没有办法在这里testing,但我试图解决你的括号。

由于我根本不明白你打算从公式中返回哪个价值,如果行匹配成功则返回“成功”,否则返回“失败”。 如果这样的话,用你想要的值replace这些string。

你的OP“我有两个文件,我需要查找单元格,并确保它们匹配”

因此,看看你的公式中的第一个testing,大概进入工作表的H列,在那里你的数据被testing:

 V:V='[HW inbound shipment info 21 Oct (2).xls]Inbound'!$W:$W 

如果V1 = '[HW inbound shipment info 21 Oct (2).xls]Inbound'!W1任何其他行,则V1 = '[HW inbound shipment info 21 Oct (2).xls]Inbound'!W1将返回TRUE V1 = '[HW inbound shipment info 21 Oct (2).xls]Inbound'!W1但是FALSE '[HW inbound shipment info 21 Oct (2).xls]Inbound'!$W:$W

列的比较隐式地testinginput公式的行中的相等性。 我希望尽可能明确。

可以使用查找函数VLOOKUPMATCH一个查找V列中的PN / Item是否存在于'[HW inbound shipment info 21 Oct (2).xls]Inbound'!$W:$W中的任何位置。 例如:

= MATCH(V1, '[HW inbound shipment info 21 Oct (2).xls]Inbound'!$W:$W,0)

即使search到的数组未被sorting,也会在'[HW inbound shipment info 21 Oct (2).xls]Inbound'!$W:$W返回V1的第一个匹配的行号。 如果找不到匹配,它将返回#N/A错误。 如果V1在search的数组中,您需要首先进行testing:

IF(ISNA(MATCH(V1,'[HW inbound shipment info 21 Oct (2).xls]Inbound'!$W:$W,0), FALSE, TRUE)

如果找不到匹配,则返回FALSE的原因是允许在AND函数内testing两个条件:

=AND(IF(ISNA(MATCH(V1,'[HW inbound shipment info 21 Oct (2).xls]Inbound'!$W:$W,0), FALSE, TRUE), IF(ISNA(MATCH(K1,'[HW inbound shipment info 21 Oct (2).xls]Inbound'!$X:$X,0), FALSE, TRUE) AND(TRUE, TRUE)只有在find您的PN /物品和数量的情况下才会评估为AND(TRUE, TRUE)

在这一点上所有你知道的是,这两个值是find,但你不知道他们是否在同一行,所以你需要另一个testing,铭记MATCH返回被testing的数组内的匹配值的位置:

=(MATCH(V1,'[HW inbound shipment info 21 Oct (2).xls]Inbound'!$W:$W,0) = MATCH(K1,'[HW inbound shipment info 21 Oct (2).xls]Inbound'!$X:$X,0)

如果PN / Item和QTY在同一行,将返回TRUE免责声明:testing显示,这将只适用于PN /项目和数量都是唯一的。 否则,你将不得不求助于macros观解决scheme。

要返回的值位于正在查找的列的左侧,因此无法使用VLOOKUP返回所需的值。 唯一的select是使用由您的MATCH公式之一返回的INDEX(array, row_num, [column_num])使用INDEX(array, row_num, [column_num])

=INDEX('[HW inbound shipment info 21 Oct (2).xls]Inbound'!$U:$U, MATCH(V1,'[HW inbound shipment info 21 Oct (2).xls]Inbound'!$W:$W,0))

现在我们可以把它放在H1:

=IF(AND( IF(ISNA(MATCH(V1,'[HW inbound shipment info 21 Oct (2).xls]Inbound'!$W:$W,0)),FALSE,TRUE), IF(ISNA(MATCH(K1,'[HW inbound shipment info 21 Oct (2).xls]Inbound'!$X:$X,0)), FALSE, TRUE)), IF(MATCH(V1,'[HW inbound shipment info 21 Oct (2).xls]Inbound'!$W:$W,0) =MATCH(K1,'[HW inbound shipment info 21 Oct (2).xls]Inbound'!$X:$X,0), INDEX('[HW inbound shipment info 21 Oct (2).xls]Inbound'!$U:$U, MATCH(V1,'[HW inbound shipment info 21 Oct (2).xls]Inbound'!$W:$W,0)),""),"")

添加缩进使其更容易阅读。

试图通过创build一个硬件入库货件信息21十月(2).xls工作簿与入站表具有testing数据在列U,W和X.