Excel 2016:在单元格中搜索多个术语 [英] Excel 2016: Searching for multiple terms in a cell

查看:115
本文介绍了Excel 2016:在单元格中搜索多个术语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Excel 2016中使用OR条件在单元格中搜索多个字符串.

I'm trying to do a search for multiple strings in a cell with an OR-condition in Excel 2016.

例如我有一个字符串abcd1234,我想找到ab OR 12.

E.g. I have a string abcd1234 and I want to find ab OR 12.

我正在使用德语版本,其中功能SEARCH被称为SUCHEN,它的行为应相同.

I'm using the german version where the function SEARCH is called SUCHEN and it should behave the same way.

我找到了此答案建议此解决方案:

I found this answer which suggests this solution:

SEARCH({"Gingrich","Obama","Romney"},C1).

我还找到了此网站,它暗示了相同的含义语法:

I also found this website which suggests the same syntax:

SEARCH({"red","blue","green"},B5)

此网站相同:

SEARCH({"mt","msa","county","unemployment","|nsa|"},[@Tags])

因此,他们基本上说要列出由大括号括起来的逗号分隔的搜索词,您就很好了.

So they basically say make a list of search terms separated by commas enclosed by curly braces and you're good.

但是将它们放到Excel 2016中只会导致通常无意义的Excel错误消息,该错误消息指出公式有错误,并且总是用花括号突出显示整个部分.

But putting these into Excel 2016 just results in the usual meaningless Excel error message which says there was an error with the formula and it's always highlighting the whole part in curly braces.

以第一个示例为例,我可以使Excel不抛出错误消息的唯一方法是更改​​语法,如下所示:

Taking the first example the only way I could get Excel to not throw its error message was to change the syntax like this:

=SEARCH({"Gingrich";"Obama";"Romney"};C1)

但是用分号分隔搜索词并不能正确应用OR条件,因此这不是解决方案.

But separating the search terms with semicolons doesn't apply the OR-condition correctly, so this is not the solution.

我从这个答案知道分开进行搜索,然后将它们与条件串在一起,但是我想避免这种情况,并且我还想知道为什么应该由多个来源确认的语法对我来说不起作用.

I'm aware from this answer that I could make separate searches and string them together with a condition, but I would like to avoid that, and I also want to know why the syntax that is supposed to work as confirmed by multiple sources is not working for me.

好吧,感谢索拉·迈克(Solar Mike):

Okay, I'm starting to understand this, thanks to Solar Mike:

代码=IF(COUNT(SEARCH({"Romney","Obama","Gingrich"},A1)),1,"")确实可以很好地工作.

The code =IF(COUNT(SEARCH({"Romney","Obama","Gingrich"},A1)),1,"") works indeed perfectly fine.

=COUNT(SEARCH({"Romney","Obama","Gingrich"},A1))也可以.

但是=SEARCH({"Romney","Obama","Gingrich"},A1)不会.

=ISNUMBER(SEARCH({"Gingrich","Obama","Romney"},A1))不起作用.

我很想知道为什么.

推荐答案

好的,所以可行:

OR(IFERROR(FIND("ab",A1,1),0),IFERROR(FIND("12",A1,1),0))

在这里测试:

我遵循了其中一个链接和这样的版本:

I followed one of the links and the version like this:

=IF(COUNT(SEARCH({"Romney","Obama","Gingrich"},C1)),1,"")

按我的预期工作,但是如果隔离搜索,它将失败,并且我没有找到解释...

worked as expected for me, but if the search is isolated it then fails and I have not found an explanation ...

这篇关于Excel 2016:在单元格中搜索多个术语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆