[英]Excel: Return value if cell contains a certain text
there are 2 cells. 有2个单元格。
One contains string 一个包含字符串
"AA BB CC DD" “ AA BB CC DD”
And the second one 还有第二个
"AABBCCCDD" “AABBCCCDD”
I want to make formula that return value "true", when cells contains "BB". 当单元格包含“ BB”时,我想使公式返回值“ true”。 If I use find or search formulas, it returns true for all of them.
如果使用查找或搜索公式,则所有公式都返回true。 Nevertheless, there's another condition.
然而,还有另一个条件。 I want to use this:
我想用这个:
=IF(IS.NUMBER(SEARCH(" BB "..... = IF(IS.NUMBER(SEARCH(“ BB” .....
Search is consisted of 2 main parameter -> what and where. 搜索由2个主要参数->什么和在哪里组成。 I want to add 2 values into "what".
我想将2个值添加到“ what”中。 Something like:
就像是:
If cell contains " BB " or "BeBe" then... 如果单元格包含“ BB”或“ BeBe”,则...
I hope it' clear. 我希望这很清楚。
Thanks 谢谢
You can search for multiple strings by passing array of strings {}
and wrapping in AND()
: 您可以通过传递字符串数组
{}
并将其包装在AND()
来搜索多个字符串:
=AND(ISNUMBER(SEARCH({"AA","BB"},A1)))
Alternatively, you can wrap it in OR()
if you need at least one match, not all of them: 另外,如果您需要至少一个匹配项,而不是全部匹配项,则可以将其包装在
OR()
:
=OR(ISNUMBER(SEARCH({"AA","BB"},A1)))
Wrap it in a SUMPRODUCT: 将其包装在SUMPRODUCT中:
=SUMPRODUCT(1*(ISNUMBER(SEARCH({" BB ","BeBe"},A1))))>0
SEARCH() is not case sensitive so it will return true for "BEBE" If you want case sensitive use FIND: SEARCH()不区分大小写,因此对于“ BEBE”它将返回true,如果要区分大小写,请使用FIND:
=SUMPRODUCT(1*(ISNUMBER(FIND({" BB ","BeBe"},A1))))>0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.