英文:
Filter based on a range of Values
问题
=REGEXMATCH(B:B, INDIRECT("Sheet2!D1"))
=REGEXMATCH(B:B, JOIN("|", Sheet2!D1:D2))
英文:
OK - So imagine I have a column with a number of street addresses:
1 Fred St
7 John St
3 Fred Avenue
12 John St
15 Alex st
In another sheet, I have a series of street names in which I am interested:
John
Fred
I want to filter the first sheet to display rows which contain either John or Fred. I've tried a filter based on a custom formula. This will find all the ones with John:
=REGEXMATCH(A:A, "John")
and this will work if John
is in D1
=REGEXMATCH(B:B, $D$1)
First how do I get this latter one to work if D1 is in a different sheet? Can I prefix the sheet name somehow? Secondly, how do I get it to work based on a series of different values (like John and Fred) stored elsewhere.
=REGEXMATCH(B:B, $D$1:$D$2)
答案1
得分: 0
你可以使用TEXTJOIN来连接一个范围内的所有单元格,避免空单元格:例如,这个公式将会使用列D中的所有值。显然,如果你想要的话,你可以缩小范围,但这只是为了向你展示:
=REGEXMATCH(B:B, TEXTJOIN("|",1,$D$1:$D))
英文:
You can use TEXTJOIN to concatenate all the cells of a range, avoiding empty cells: for example, this formula would take all column D. Obviously you can narrow it if you want, but just to show you:
=REGEXMATCH(B:B, TEXTJOIN("|",1,$D$1:$D))
答案2
得分: 0
=REGEXMATCH()
将以简单方式工作,您也可以尝试以下-
=LAMBDA(lm,FILTER(lm,
MAP(lm,LAMBDA(x,OR(INDEX(ISNUMBER(SEARCH(SPLIT(x," "),TEXTJOIN("|",1,H2:H)))))))))
(A2:INDEX(A2:A,COUNTA(A2:A)))
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论