Is it possible to use FILTER with BYROW to get a spill? If not, how else can this be done?

Rnkhch

Well-known Member
Joined
Apr 28, 2018
Messages
578
Office Version
  1. 365
Platform
  1. Windows
Hello,

Suppose I have the range in the attached XL2BB, and I FILTER each row for numbers greater than 50. Can use BYROW to get the indicated result in a single spill? If not, is there another way?

=BYROW(B3:G11,LAMBDA(a,FILTER(a,a>50)))
this gives the "nested arrays not supported" error :oops:

Blank power workbook1
ABCDEFGHIJKLMN
1
2desired output
31754496946175469
46598504252100659852100
5694477184994697794
66889224047266889
74433242777807780
85314829153885382915388
98316969597638396959763
1022836086309683608696
119833899551579889955157
12
Sheet3


Thanks for any input! 🤗
 
Hi Peter,

Your second formula (below) is amazing, and I made a lot of progress on it:

=IFERROR(TEXTSPLIT(SUBSTITUTE(TEXTJOIN(",",1,SCAN("",B3:G11,LAMBDA(a,b,IF(COLUMN(b)=COLUMN(B3),"|","")&IF(b>50,b,"")))),"|,","|"),",","|",1)+0,"")

But, it appears that it only works when the SCAN array (first bolded section in the above formula) is a selected range, and as soon as I substitute it with an array (as in the attached XL2BB and below), the formula crashes. I believe the issue comes from the part of the formula that deals with columns (second bolded section).

By any chance, could you do a magic so that the modified formula also works?

=IFERROR(TEXTSPLIT(SUBSTITUTE(TEXTJOIN(",",1,SCAN("",IF(I3#,B3:G11,""),LAMBDA(a,b,IF(COLUMN(b)=COLUMN(B3),"|","")&IF(b>50,b,"")))),"|,","|"),",","|",1)+0,"")

newtemp 2022 12 23.xlsx
ABCDEFGHIJKLMNO
1
2
3175449694617111111
46598504252100111111
5694477184994111111
668892240book26111101
7443324277780111111
8531482915388111111
98316c959763110111
10228360863096111111
11983389955157111111
12
13Text
145469
15659852100
16697794
176889book
187780
195382915388
2083c959763
2183608696
229889955157
23
24Numerical
25 
26
27
28
29
30
31
32
33
34
Sheet5
Cell Formulas
RangeFormula
I3:N11I3=IF(ISNUMBER(B3:G11),1,0)
B14:F22B14=TEXTSPLIT(SUBSTITUTE(TEXTJOIN(",",1,SCAN("",B3:G11,LAMBDA(a,b,IF(COLUMN(b)=COLUMN(B3),"|","")&IF(b>50,b,"")))),"|,","|"),",","|",1,,"")
B25B25=IFERROR(TEXTSPLIT(SUBSTITUTE(TEXTJOIN(",",1,SCAN("",IF(I3#,B3:G11,""),LAMBDA(a,b,IF(COLUMN(b)=COLUMN(B3),"|","")&IF(b>50,b,"")))),"|,","|"),",","|",1)+0,"")
Dynamic array formulas.
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
I'm not sure what your ultimate goal is, but I'm wondering why have the separate I3# just to determine if B3:G11 is a number or not? Why not just add that check into the existing formula?

=IFERROR(TEXTSPLIT(SUBSTITUTE(TEXTJOIN(",",1,SCAN("",B3:G11,LAMBDA(a,b,IF(COLUMN(b)=COLUMN(B3),"|","")&IF(AND(ISNUMBER(b),b>50),b,"")))),"|,","|"),",","|",1)+0,"")
 
Upvote 0
Thanks Peter. So, in the final LAMBDA, I'll be using my ISXTYPE function for high-resolution data-type checking/picking, so the I3# will be generated like in the examples below:

IF(ISXTYPE(B3:G11,1),1,0) (where 1 means number)
IF(ISXTYPE(B3:G11,{1,2}),1,0) (both numbers and text)
etc.

This way, I can ask the formula to only pick any one or more of the data types (in my most recent version of ISXTYPE which I haven't posted in the LAMBDA forum yet, you could pick any single or combination of data types that you want such as {1,4} or {2,16} or {1,32,41}, etc.)

So my goal is to leave the part of your formula that contains b>50 for the purpose of checking "match_criteria", (which may or may not be entered).

That's the reason that I wanted to be able to include an array in your formula at the first bolded location in my post #11.

By the way, here is how the intended LAMBDA for this kind of filtering will look like (not finalized yet; I may add other parameters):

FUNCTION(array,types,[filter_by],[match_criteria],[if_empty])
where filter_by will get 0 (or empty) for filtering by rows and 1 by columns

Let me know if you need more explanation.

Thanks 🤗
 
Upvote 0
I would going to try an Ai chat to explain a formula, but it is currently down. :unsure:. Not sure if they work for excel formulas. You should check out @Xlambda's ABYROW formula.
Hi guys, sorry to bother, I am here because I just saw the notification that I was mentioned by @jaeiow.
All you need is a general use (like BYROW) lambda helper function that can spill results by row.
It is called RBYROW, Row Byrow same arguments as BYROW. Check this link: AUNIQUE
Excel Formula:
=LAMBDA(ar, fn,
    LET(
        a, IF(ar = "", "", ar),
        c, --(COLUMNS(a) = 1),
        r, REDUCE(0, SEQUENCE(ROWS(a)), LAMBDA(v, i, VSTACK(v, fn(INDEX(a, i, c))))),
        DROP(IFNA(r, ""), 1)
    )
)
Book1
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAK
1Task: sort unique filter values >15, by row
2sample
3=RBYROW(B4:G12,LAMBDA(x,FILTER(x,x>50,"")))=RANDARRAY(9,6,10,30,1)=RBYROW(T4#,LAMBDA(x,SORT(UNIQUE(FILTER(x,x>15),1),,,1)))
417544969461754692628152729252526272829
56598504252100659852100221218151610161822
669447718499469779423242625142323242526
76889224047266889211419272121192127
8443324277780778024281714272717242728
953148291538853829153881926181429241819242629
10831696959763839695976328151422161916192228
11228360863096836086962424241310171724
12983389955157988995515725142814192619252628
13
14if some row has no resultsNow, let's say that for a very repetitive task we alteady have a lambda Sort Unique Grater Than 15 SUGT15
15=RBYROW(B16:G25,LAMBDA(x,FILTER(x,x>50,"")))SUGT15(x)=LAMBDA(x,SORT(UNIQUE(FILTER(x,x>15),1),,,1))
161754496946175469
176598504252100659852100We just call:
18694477184994697794=RBYROW(T4#,SUGT15)
1968892240472668892526272829
204433242777807780161822
2134494929474823242526
225314829153885382915388192127
23831696959763839695976317242728
24228360863096836086961819242629
25983389955157988995515716192228
261724
2719252628
28
Sheet2
Cell Formulas
RangeFormula
J3,AA18,J15,AA3,T3J3=FORMULATEXT(J4)
J4:N12J4=RBYROW(B4:G12,LAMBDA(x,FILTER(x,x>50,"")))
T4:Y12T4=RANDARRAY(9,6,10,30,1)
AA4:AE12AA4=RBYROW(T4#,LAMBDA(x,SORT(UNIQUE(FILTER(x,x>15),1),,,1)))
J16:N25J16=RBYROW(B16:G25,LAMBDA(x,FILTER(x,x>50,"")))
AA19:AE27AA19=RBYROW(T4#,SUGT15)
Dynamic array formulas.
 
Upvote 0
Thank you so much @Xlambda! 🤗 I actually meant to ask your opinion. This is very helpful!

I'll work with RBYROW and see if I can make it automatically remove the rows that come out as empty.

Also I was searching for RBYCOL to see if you have posted it, but the search on the LAMBDA forum returns no results. I assumed you probably created RBYCOL also? If so, could you please share the code? Thanks much, and Happy Holidays!
 
Upvote 0
CBYCOL, column bycol (I know, it gets rough with the names). It is posted here: AUNIQUE
But if you mean Row bycol, I'm not sure if something exists or what the use case would be.
 
Upvote 0
Thank you so much @Xlambda! 🤗 I actually meant to ask your opinion. This is very helpful!

I'll work with RBYROW and see if I can make it automatically remove the rows that come out as empty.

Also I was searching for RBYCOL to see if you have posted it, but the search on the LAMBDA forum returns no results. I assumed you probably created RBYCOL also? If so, could you please share the code? Thanks much, and Happy Holidays!
You are very welcome!
CBYCOL Column BYCOL
Excel Formula:
=LAMBDA(ar, fn,
    LET(
        a, IF(ar = "", "", ar),
        w, --(ROWS(a) = 1),
        r, REDUCE(0, SEQUENCE(COLUMNS(a)), LAMBDA(v, i, HSTACK(v, fn(INDEX(a, w, i))))),
        DROP(IFNA(r, ""), , 1)
    )
)
And a formula to exclude empty rows(assuming entire row is empty when first value/row is empty), Also is easy to change the function if you need other conditions like >45.
=LET(a,B16:G25,fn,LAMBDA(x,FILTER(x,x>50,"")),r,RBYROW(a,fn),FILTER(r,TAKE(r,,1)<>""))
Book2
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAK
1Task: sort unique filter values >15, by row
2sample
3=RBYROW(B4:G12,LAMBDA(x,FILTER(x,x>50,"")))=RANDARRAY(9,6,10,30,1)=RBYROW(T4#,LAMBDA(x,SORT(UNIQUE(FILTER(x,x>15),1),,,1)))
4175449694617546930161124263016242630
5659850425210065985210026272013111717202627
669447718499469779416261627162316232627
76889224047266889191013152420192024
844332427778077802127131630181618212730
9531482915388538291538821132527101616212527
108316969597638396959763182211142611182226
112283608630968360869629141312141029
129833899551579889955157141525141822182225
13
14if some row has no resultsNow, let's say that for a very repetitive task we alteady have a lambda Sort Unique Grater Than 15 SUGT15
15=RBYROW(B16:G25,LAMBDA(x,FILTER(x,x>50,"")))SUGT15(x)=LAMBDA(x,SORT(UNIQUE(FILTER(x,x>15),1),,,1))
161754496946175469
176598504252100659852100We just call:
18694477184994697794=RBYROW(T4#,SUGT15)
19688922404726688916242630
20443324277780778017202627
2134494929474816232627
225314829153885382915388192024
2383169695976383969597631618212730
242283608630968360869616212527
259833899551579889955157182226
2629
27extracting empty rows182225
28=LET(a,B16:G25,fn,LAMBDA(x,FILTER(x,x>50,"")),r,RBYROW(a,fn),FILTER(r,TAKE(r,,1)<>""))
295469
30659852100
31697794
326889
337780
345382915388
358396959763
3683608696
379889955157
38
Sheet2
Cell Formulas
RangeFormula
J3,J28,AA18,J15,AA3,T3J3=FORMULATEXT(J4)
J4:N12J4=RBYROW(B4:G12,LAMBDA(x,FILTER(x,x>50,"")))
T4:Y12T4=RANDARRAY(9,6,10,30,1)
AA4:AE12AA4=RBYROW(T4#,LAMBDA(x,SORT(UNIQUE(FILTER(x,x>15),1),,,1)))
J16:N25J16=RBYROW(B16:G25,LAMBDA(x,FILTER(x,x>50,"")))
AA19:AE27AA19=RBYROW(T4#,SUGT15)
J29:N37J29=LET(a,B16:G25,fn,LAMBDA(x,FILTER(x,x>50,"")),r,RBYROW(a,fn),FILTER(r,TAKE(r,,1)<>""))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,135
Members
453,021
Latest member
Justyna P

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