简体   繁体   English

如何从一个范围中搜索多个名称并返回excel中的多条记录?

[英]How to search multiple names from a range and return multiple records in excel?

I have tried searching on SO, and certainly have not found solution for similar problems, may be I haven't used the right word to search.我试过在 SO 上搜索,当然没有找到类似问题的解决方案,可能是我没有使用正确的词来搜索。

So, Column A & Column B is my database, and Column D shows those rep names which I require as an output. I have tried using FILTER with SEARCH & ISNUMBER Function but it returns only one因此,A 列和 B 列是我的数据库,D 列显示了我需要的代表名称 output。我尝试将FILTERSEARCHISNUMBER Function 一起使用,但它只返回一个

=FILTER($A$2:$B$13,ISNUMBER(SEARCH($D$2:$D$4,$A$2:$A$13))=TRUE)

Images shown:显示的图像:

公式

EDIT -- 07-05-2022编辑——07-05-2022

Try using the formula as shown in image below,尝试使用下图所示的公式,

• Formula used in cell F2 --> Applicable To Excel 2021 & O365 Users • 单元格F2中使用的公式 -->适用于 Excel 2021 和 O365 用户

=FILTER(A2:B13,MMULT(--ISNUMBER(SEARCH(TRANSPOSE(D2:D4),A2:A13)),ROW(D2:D4)^0)=1)

• Formula can be used in cell F2 --> Applicable to All Excel Users Except Excel 2007 • 公式可用于单元格F2 -->适用于所有 Excel 用户,Excel 2007 除外

=IFERROR(INDEX($A$2:$B$13,
AGGREGATE(15,6,(ROW($A$2:$A$13)-ROW($A$2)+1)/
ISNUMBER(SEARCH(TRANSPOSE($D$2:$D$4),$A$2:$A$13)),
ROW($A1)),{1,2}),"")

And Fill Down!并填满!

公式_溶液


Two more alternatives,还有两个选择,

=LET(list,A2:B13,
p,A2:A13,
q,D2:D4,
x,--BYROW(p,
LAMBDA(a,(SUM(COUNTIF(a,"*"&q&"*"))>0))),
FILTER(list,x=1))

=LET(list,A2:B13,
p,A2:A13,
q,D2:D4,
x,MAP(p,LAMBDA(a,IF(SUM(COUNTIF(a,"*"&q&"*"))>0,a,""))),
FILTER(list,x<>""))

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

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