如何检查单元格是否包含通配符(*)字符 [英] How to check if cell contains wildcard asterisk (*) character
问题描述
考虑以下两个公式:
=IF(SEARCH("*", A1), "true", "false")
=IF(SEARCH(CHAR(42), A1), "true", "false")
我正在使用它来尝试检测单元格是否包含 *
强>字符,但这会为所有单元格返回true。我只能假设Excel以通配符的形式看到 *
。
I am using this to try and detect if a cell contains a *
character, but this returns "true" for all cells. I can only assume that Excel sees *
as a wildcard maybe.
您在Excel中检测到 *
的存在?
How do you detect the existence of a *
in Excel?
推荐答案
根据微软的参考,您应该可以使用〜
According to this reference of microsoft you should be able to use ~
Microsoft Excel使用波形符号(〜)作为标记来指示
下一个字符是一个字面值。当您使用查找和替换对话框
框来查找或替换像波浪号(〜),星号
(*)或问号(?)等字符时,您必须添加波浪号(〜)之前的
字符在查找内容框中。
Microsoft Excel uses the tilde (~) as a marker to indicate that the next character is a literal. When you use the Find and Replace dialog box to find or replace a character such as a tilde (~), an asterisk (*), or a question mark (?), you must add a tilde (~) before the character in the Find what box.
所以更改 = IF SEARCH(*,A1),true,false)
to = IF(SEARCH(〜*,A1),true )
,它应该工作。
So change =IF(SEARCH("*", A1), "true", "false")
to =IF(SEARCH("~*", A1), "true", "false")
and it should work.
这篇关于如何检查单元格是否包含通配符(*)字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!