[英]How to have a VLookup in the same worksheet in Excel
我有以下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
在C
列中,我得到一個#N/A
我要實現的是,如果fg
在A列中,請向我顯示C列中B列的值。
我該如何實現?
您需要使用if(iserror(vlookup()),“”,vlookup()將方括號括起來
所以
= IF(ISERROR(VLOOKUP( “FG”,$ A $ 1:$ B $ 11,2,FALSE)), “”,VLOOKUP( “FG”,$ A $ 1:$ B $ 11,2,FALSE))
基本上,如果找不到fg,則會引發錯誤。 if(iserror())表示如果收到錯誤,則返回空白單元格。 如果沒有錯誤(存在fg),請返回第2列。
在當前表中,此函數將為所有行返回“”,因為它們都不是“ fg”。 如果您想要包含其中的任何內容,則可以使用其他人提到的通配符,但這聽起來像您想要准確的匹配。
您只需要更改為
VLOOKUP("fg",$A$1:$B$11,2,FALSE)
您得到"fg"
#N/A
因為VLOOKUP
中的"fg"
正在搜索完全匹配(即“ fg”),並且列A中沒有一個。
而是使用通配符 。 例子:
=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.