ASEARCH

=ASEARCH(a,as,sf,st)

a
array
as
array search/find
sf
search/find argument, 0 or ignored for SEARCH, 1 for FIND
st
search type, 0 or ignored for any cell, 1, same row, 2, same cell

array search, filters the search/find results of an array "as" within another array "a" according with the search type "st"

Xlambda

Well-known Member
Joined
Mar 8, 2021
Messages
860
Office Version
  1. 365
Platform
  1. Windows
ASEARCH array search, filters the search/find results of an array "as" within another array "a" according with the search type "st". calls T_SF
st=0, any cell, function will filter all the rows with at least 1 occurrence of any of the search values
st=1, all in same row, function will filter all the rows with at least 1 occurrence of all the search values
st=2, all in same cell, function will filter all the rows with at least 1 cell with all occurrences in it.
Note: Extremely useful in real life, for large wide tables with a lot of text info, no need of column filters, the classic formula that I used before recursion lambdas was a challenge.
Excel Formula:
=LAMBDA(a,as,sf,st,
    LET(d,"|",s,SEQUENCE(COUNTA(as)),t,TEXTJOIN(d,,s),
       x,T_SF(a,as,sf,),y,ATEXTJOIN(x,,,d),z,T_SF(y,s,,),
       w,SWITCH(st,0,z<>"",1,z=t,2,MMULT(--(x=t),SEQUENCE(COLUMNS(a)))>0),
       FILTER(a,w,"not found")
    )
)
LAMBDA 7.0.xlsx
ABCDEFGHIJKLMNOPQR
1samplesearch/find array
2aaYaaKaaaaZXYZ
3bbbbbybbbKW
4czccxcccckc
5dddddddd
6eexweezyxeekwee
7ffffffff
8ggYZKWXgggggg
9hhhhhhhzyxkwh
10
11=ASEARCH(A2:H9,J2:L3,0,0)sf=0st=0=ASEARCH(A2:H9,J2:L3,0,1)sf=0st=1
12aaYaaKaaaaZeexweezyxeekwee
13bbbbbybbbggYZKWXgggggg
14czccxcccckchhhhhhhzyxkwh
15eexweezyxeekwee
16ggYZKWXgggggg=ASEARCH(A2:H9,J2:L3,1,1)sf=0st=1
17hhhhhhhzyxkwhggYZKWXgggggg
18
19=ASEARCH(A2:H9,J2:L3,1,0)sf=1st=0=ASEARCH(A2:H9,J2:L3,0,2)sf=0st=2
20aaYaaKaaaaZggYZKWXgggggg
21ggYZKWXgggggghhhhhhhzyxkwh
22
23=ASEARCH(A2:H9,J2:L3,1,2)sf=1st=2
24ggYZKWXgggggg
25
ASEARCH post
Cell Formulas
RangeFormula
A11,J23,J19,A19,J16,J11A11=FORMULATEXT(A12)
A12:H17A12=ASEARCH(A2:H9,J2:L3,0,0)
J12:Q14J12=ASEARCH(A2:H9,J2:L3,0,1)
J17:Q17J17=ASEARCH(A2:H9,J2:L3,1,1)
A20:H21A20=ASEARCH(A2:H9,J2:L3,1,0)
J20:Q21J20=ASEARCH(A2:H9,J2:L3,0,2)
J24:Q24J24=ASEARCH(A2:H9,J2:L3,1,2)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,222
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top