[英]How to have a VLookup in the same worksheet in Excel
I have the following Excel data: 我有以下Excel数据:
A B C
1 asdasd asdasd VLOOKUP("fg",$A$1:$A$11,2,FALSE)
2 asdasd dfgd
3 asdasd fghfgh
4 asdasd tryrty
5 asdasd 456456
6 asdasd 45456
7 asdasd 456456
8 fgddgh 46fgtfgh
9 fghfgh 46456
10 dfgdfg 456546
11 fghfgh 456456
In the C
column, I am getting a #N/A
在
C
列中,我得到一个#N/A
What I am looking to achieve is if fg
is in column A, show me the value of column B in column C. 我要实现的是,如果
fg
在A列中,请向我显示C列中B列的值。
How can I achieve that? 我该如何实现?
You need to bracket your vlookup with if(iserror(vlookup() ), "", vlookup()) 您需要使用if(iserror(vlookup()),“”,vlookup()将方括号括起来
so 所以
=if(iserror(VLOOKUP("fg",$A$1:$B$11,2,FALSE)),"",VLOOKUP("fg",$A$1:$B$11,2,FALSE)) = IF(ISERROR(VLOOKUP( “FG”,$ A $ 1:$ B $ 11,2,FALSE)), “”,VLOOKUP( “FG”,$ A $ 1:$ B $ 11,2,FALSE))
Basically if it can't find fg, it throws an error. 基本上,如果找不到fg,则会引发错误。 The if( iserror()) says if you get an error, return blank cell.
if(iserror())表示如果收到错误,则返回空白单元格。 If there's no error, (fg exists), return column 2.
如果没有错误(存在fg),请返回第2列。
In your current table, this function will return "" for all lines since none of them = "fg". 在当前表中,此函数将为所有行返回“”,因为它们都不是“ fg”。 If you want anything that contains, you can use wild cards someone else mentioned but it sounds like you want exact hits.
如果您想要包含其中的任何内容,则可以使用其他人提到的通配符,但这听起来像您想要准确的匹配。
您只需要更改为
VLOOKUP("fg",$A$1:$B$11,2,FALSE)
You get #N/A
because "fg"
in the VLOOKUP
is searching for an exact match (ie "fg") and there isn't one in your column A. 您得到
"fg"
#N/A
因为VLOOKUP
中的"fg"
正在搜索完全匹配(即“ fg”),并且列A中没有一个。
Instead use a wildcard . 而是使用通配符 。 Examples:
例子:
=VLOOKUP("fg",A2:B11,2,FALSE) //gets exact match
=VLOOKUP("*fg",A2:B11,2,FALSE) //matches when `fg` at the end e.g. `aaaafg`
=VLOOKUP("fg*",A2:B11,2,FALSE) //matches when `fg` at the start e.g. `fgaaaa`
=VLOOKUP("*fg*",A2:B11,2,FALSE) //matches when `fg` found in the entry e.g. `aafgaa`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.