简体   繁体   English

Excel:如果单元格包含特定文本,则返回值

[英]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.

相关问题 Excel:如果单元格包含特定值,则将某些文本放入新单元格中 - Excel : If cell contains certain value then put certain text in new cell Excel - 如果单元格包含列表中的文本,则返回另一个单元格的值 - Excel - if cell contains text in a list then return value of another cell Excel-如果行包含特定值,则重命名单元格 - Excel - Rename cell if row contains certain value Excel:如果其他单元格包含特定值,则添加值 - Excel: adding value if the other cell contains certain value Excel 检查单元格是否包含列表中的文本并从列表中返回值 - Excel check if cell contains text from list and return value from list Excel函数:如果单元格包含某些文本,则执行特定公式 - Excel function: IF a cell contains certain text, then a specific formula executes 如果另一个单元格包含特定文本,Excel中是否可以显示某个单元格? - Is there a way in Excel to display a certain cell if another contains specific text? Excel VBA:如果单元格包含某些文本,则输入具有该内容的单元格范围 - Excel VBA: If cell contains certain text then input range of cells with that content Excel-如果单元格包含一个值,则返回另一个值(如果未搜索其他值) - Excel - IF a cell contains a value return another value, if not search for a different value 如果单元格包含某个字符串值,则在Excel中隐藏行 - Hide rows in Excel if a cell contains a certain string value
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM