[英]Excel: search multiple strings then return value
I am using the following formula to search for a string and return a value我正在使用以下公式来搜索字符串并返回一个值
IF(ISNUMBER(SEARCH("CHA*",B:B),"CINEMA","")
If I want to search for multiple strings whats the formula?, I've tried the following but it isn't returning anything如果我想搜索多个字符串,公式是什么?,我尝试了以下操作,但没有返回任何内容
IF(ISNUMBER(SEARCH({"odeon*","vue*"},B:B),"CINEMA","")
Try this:尝试这个:
=IF(COUNT(SEARCH({"odeon*","vue*"},B:B))>0,"CINEMA","")
Another way:其它的办法:
=IF(OR(ISNUMBER(SEARCH({"odeon*","vue*"},B:B))),"CINEMA","")
Use AND()
if you require ALL substrings to match:如果您需要匹配所有子字符串,请使用AND()
:
=IF(AND(ISNUMBER(SEARCH({"odeon*","vue*"},B:B))),"CINEMA","")
For starters, you're missing a )
on either formula.首先,您在任一公式中都缺少)
。 And for them to work anyway, you should, as Taosique pointed out, use =IF(OR(ISNUMBER(SEARCH(
if you need just one substring, or =IF(AND(ISNUMBER(SEARCH(
if you require both.无论如何,为了让它们正常工作,你应该,正如陶斯克指出的那样,使用=IF(OR(ISNUMBER(SEARCH(
如果你只需要一个子字符串),或者=IF(AND(ISNUMBER(SEARCH(
如果你需要两个。
Good luck!祝你好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.