[英]Check if an excel cell exists on another worksheet in a column - and return the contents of a different column
What I want to do is to say if the contents of cell D3
(on current worksheet) exist in column A
in the first worksheet (in my case entitled list). 我想要做的是说,如果单元格的内容
D3
列存在(当前工作表) A
在第一个工作表(在我的情况下有权获得列表)。 (and they always do exist somewhere). (而且它们总是在某处存在)。 Return the contents of the corresponding row in Column
C
. 返回
C
列中相应行的内容。
In other words if the matching cell is found in Row 12
- return data from C12
. 换句话说,如果在第
12
行中找到匹配的单元格 - 从C12
返回数据。
I've used the following syntax but I can't seem to get the last part to work correctly. 我使用了以下语法,但似乎无法使最后一部分正常工作。
=IF(ISERROR(MATCH(D3,List!A:A, 0)), "No Match", VLOOKUP(D3,List!A:A,1,TRUE))
How to fix the formula? 如何修复公式?
You can use following formulas. 您可以使用以下公式。
For Excel 2007 or later: 对于Excel 2007或更高版本:
=IFERROR(VLOOKUP(D3,List!A:C,3,FALSE),"No Match")
For Excel 2003: 对于Excel 2003:
=IF(ISERROR(MATCH(D3,List!A:A, 0)), "No Match", VLOOKUP(D3,List!A:C,3,FALSE))
Note, that 注意
List!A:C
in VLOOKUP
and returns value from column № 3
VLOOKUP
使用List!A:C
并从第3
列返回值 VLOOKUP
equals to FALSE
, in that case VLOOKUP
will only find an exact match, and the values in the first column of List!A:C
do not need to be sorted (opposite to case when you're using TRUE
). VLOOKUP
等于FALSE
,在这种情况下, VLOOKUP
将只找到完全匹配的,并在第一列中的值List!A:C
不需要进行排序(相反情况下,当你使用TRUE
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.