简体   繁体   English

在Excel中跨多个单元格查找多个值

[英]Find Multiple Values Across Multiple Cells in Excel

I'm trying to figure out a way to search for multiple strings in Excel across multiple cells. 我试图找出一种方法来跨多个单元格在Excel搜索多个字符串。 I'm working with a database list of individuals and their corresponding address and demographic information. 我正在处理个人及其相关地址和人口统计信息的数据库列表。 I need to find out a count and isolate the records of any cells with any of the names in the below formula in them. 我需要找出一个计数并使用以下公式中的任何名称隔离任何单元格的记录。 The formula works just fine when I'm only looking in one cell, ie B16 , but when I put in for example (B16:D16) it throws a #VALUE error. 当我只查看一个单元格(即B16 ,该公式工作正常,但是例如当我放入(B16:D16)它将引发#VALUE错误。

=IF(OR(B16={"JOHN","CATHLEEN","JANES"}),1,0)

Any help you can offer is very much appreciated. 非常感谢您提供的任何帮助。

Thanks, Bill 谢谢,比尔

    =IF(OR(B16:D16="John",B16:D16="Cathleen",B16:D16="Janes"),1,0)

This works as long as at least one of the names is in the range. 只要名称中的至少一个在范围内,此方法就起作用。 If none of the names are in the range it will throw the #Value error. 如果这些名称均不在此范围内,则将引发#Value错误。 You could trap that out by wrapping this formula in an "IFERROR" function. 您可以通过将此公式包装在“ IFERROR”函数中来解决此问题。 I'm not sure how much use this formula is in that it only tells you that at least one of the names exists in the range, not which name or where in the list. 我不确定此公式的用途是什么,因为它仅告诉您范围中至少存在一个名称,而不是列表中的哪个名称或位置。

考虑:

=IF((SUMPRODUCT(--(B16:D16="JOHN"))+SUMPRODUCT(--(B16:D16="JANES"))+SUMPRODUCT(--(B16:D16="CATHLEEN")))=0,0,1)

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

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