[英]Ignore spaces in data using VLOOKUP
| A | B | C
----|----------------------------------------|----------------------|-----------
1 | All Countries ="All Countries" | Search Citeria: | Germany
2 | Europe =" "&"Europe" | Result: | Germany
3 | Germany =" "&"Germany" | |
4 | Spain =" "&"Spain" | |
5 | France =" "&"France" | |
6 | Asia =" "&"Asia" | |
7 | China =" "&"China" | |
8 | Japan =" "&"Japan" | |
9 | | |
10 | | |
In Column A
in the table I have listed different countries using the formulas that I displayed on the right side.在表的
Column A
中,我使用右侧显示的公式列出了不同的国家/地区。
As you can see these formulas contain spaces =" "&
to make the list looking more structured.如您所见,这些公式包含空格
=" "&
以使列表看起来更有条理。
Now, in Cell C1
I want to enter a country as a Search-Criteria
for a VLOOKUP
in Cell C2
.现在,在
Cell C1
我想输入一个国家作为Cell C2
VLOOKUP
的Search-Criteria
。
=VLOOKUP($C1,$A$1:$A$8,1,FALSE)
As a result I get #NA
which is probably caused by the spaces I use.结果我得到
#NA
这可能是由我使用的空格引起的。
Do you have any idea how I can modify the VLOOKUP
so it ignores the spaces?您知道如何修改
VLOOKUP
使其忽略空格吗?
NOTE: I know I could solve the issue by increasing the indentlevel
instead of using the =" "&
logic.注意:我知道我可以通过增加
indentlevel
而不是使用=" "&
逻辑来解决这个问题。
However, for other purposes I need to go with the =" "&
instead of the indentlevel
.但是,出于其他目的,我需要使用
=" "&
而不是indentlevel
。
If your goal is simply to check if "Germany" exists, you could use wildcards:如果您的目标只是检查“德国”是否存在,您可以使用通配符:
=IF(COUNTIF(A2:A8,"* "&C1),C1,"Not found")
I still used a space in the criteria simply to avoid C1
being part of a larger string.我仍然在标准中使用了一个空格,只是为了避免
C1
成为更大字符串的一部分。
Btw, you can also implement wildcards in your VLOOKUP
:顺便说一句,您还可以在
VLOOKUP
实现通配符:
=VLOOKUP("* "&C1,A2:A8,1,FALSE)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.