简体   繁体   English

如果单元格包含文本通配符-Excel

[英]If cell contains text wildcard - excel

I'm trying to use an IF statement to find a string of text with a wildcard in a particular cell. 我正在尝试使用IF语句在特定单元格中查找带有通配符的文本字符串。 Eg 例如

=IF(OR(K3="Fixed Rate*", K3="Mobile Rate*"), "true", "false") 

I have also tried something like this: 我也尝试过这样的事情:

=ISNUMBER(SEARCH("Fixed Rate*",K3))

But everything seems to end up in " false ". 但是,一切似乎都以“ false ”结尾。 Ideally, I would like to find if a particular cell has either wildcard of Fixed Rate ... or wildcard of Mobile Rate ... 理想情况下,我想查找某个特定的小区是否具有固定费率通配符...或移动费率通配符...

Does anyone know why and have a solution? 有谁知道为什么并且有解决方案?

Thanks in advance! 提前致谢!

You're nearly there. 你快到了 Try this: 尝试这个:

=OR(NOT(ISERROR(SEARCH("fixed rate",K3))),NOT(ISERROR(SEARCH("mobile rate",K3))))

Combining your two ideas produces the right result. 将您的两个想法结合起来会产生正确的结果。

=IF(OR(ISNUMBER(SEARCH("Fixed Rate*",K3)),ISNUMBER(SEARCH("Mobile Rate*",K3))), "true", "false")

You need to use the SEARCH function to allow wildcards, then the OR function to check for the presence of either string. 您需要使用SEARCH函数来允许通配符,然后使用OR函数来检查是否存在任何字符串。

Credits to @Olly. 归功于@Olly。 You could also do it like: 您也可以这样做:

=OR(NOT(ISERROR(MATCH("*Fixed Rate*",K3,0))),NOT(ISERROR(MATCH("*Mobile Rate*",K3,0))))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM