vba Excel中问号的意义是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4628784/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 12:29:18  来源:igfitidea点击:

What is the significance of the question mark in Excel?

excel-vbaexcel-2002vbaexcel

提问by Arlen Beiler

If I type in this formula:

如果我输入这个公式:

=vlookup(A1,LetterTable,2,False)

With A1 set to "?" (without the quotes), and LetterTable contains this:

A1 设置为“?” (不带引号),并且 LetterTable 包含以下内容:

a   a
b   b
c   c
...  ...
-   -
+   +
?   ?
!   !

It always gives me "a" (no quotes). Why is this?

它总是给我“a”(没有引号)。为什么是这样?

Also, if I copy that into an array in vba and loop through it, comparing it to the spreadsheet value, it won't find it either.

另外,如果我将它复制到 vba 中的一个数组中并循环遍历它,将它与电子表格值进行比较,它也不会找到它。

采纳答案by rskar

See http://office.microsoft.com/en-us/excel-help/vlookup-HP005209335.aspx:

请参阅http://office.microsoft.com/en-us/excel-help/vlookup-HP005209335.aspx

If range_lookup is FALSE and lookup_value is text, then you can use the wildcard characters, question mark (?) and asterisk (*), in lookup_value. A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) preceding the character.

如果 range_lookup 为 FALSE 且 lookup_value 为文本,则您可以在 lookup_value 中使用通配符、问号 (?) 和星号 (*)。问号匹配任何单个字符;星号匹配任何字符序列。如果要查找实际的问号或星号,请在字符前键入波浪号 (~)。