Problem with BYROW function to spill filtered results

Haui

Board Regular
Joined
Apr 5, 2009
Messages
210
Hi, I was playing a bit around with this RBYROW function here in post #15:
Is it possible to use FILTER with BYROW to get a spill? If not, how else can this be done?

Unfortunately, I couldn't make it work with those relatively simple sample data, i.e. generate the same result as the row-by-row filter function in one go.
The CALC#! error says 'empty array'.
And I also noted another potential issue, everything else stay the same: if row 1 (which contains no data) is deleted, all of a sudden a circ error pops up that is not detected otherwise, i.e. if the data starts only in row 2 as in this example.

What am I doing wrong with the way I have tried to use the RBYROW function for this particular problem?

Thanks

RBYROW_test.xlsx
ABCDEFGHI
1
21a1abc#CALC!
31b2ca
42c3dd
53d
63d
72a
81c
9
Sheet1
Cell Formulas
RangeFormula
C2:C4C2=UNIQUE(A2:A8)
I2I2=RBYROW(UNIQUE(A2:A8),LAMBDA(r,TOROW(FILTER(B2:B8,A2:A8=r))))
E2:G2E2=TOROW(FILTER(B2:B8,A2:A8=C2))
E3:F3E3=TOROW(FILTER(B2:B8,A2:A8=C3))
E4:F4E4=TOROW(FILTER(B2:B8,A2:A8=C4))
Dynamic array formulas.
Lambda Functions
NameFormula
RBYROW=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)))
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try:
Book1
ABCDEF
1
21aabc
31bca
42cdd
53d
63d
72a
81c
Sheet5
Cell Formulas
RangeFormula
D2:F4D2=IFNA(DROP(REDUCE("",UNIQUE(A2:A8),LAMBDA(a,b,VSTACK(a,TOROW(FILTER(B2:B8,A2:A8=b))))),1),"")
Dynamic array formulas.
 
Upvote 0
Try:
Book1
ABCDEF
1
21aabc
31bca
42cdd
53d
63d
72a
81c
Sheet5
Cell Formulas
RangeFormula
D2:F4D2=IFNA(DROP(REDUCE("",UNIQUE(A2:A8),LAMBDA(a,b,VSTACK(a,TOROW(FILTER(B2:B8,A2:A8=b))))),1),"")
Dynamic array formulas.
Thanks a lot and it working properly. Moreover, would be possible to have the result as below

A B C
A C
D
 
Upvote 0
Moreover, would be possible to have the result as below

A B C
A C
For that same layout, try
Excel Formula:
=IFNA(DROP(REDUCE("",UNIQUE(A2:A8),LAMBDA(a,b,VSTACK(a,UNIQUE(SORT(TOROW(FILTER(B2:B8,A2:A8=b)),,,1),1)))),1),"")
 
Upvote 0
For that same layout, try
Excel Formula:
=IFNA(DROP(REDUCE("",UNIQUE(A2:A8),LAMBDA(a,b,VSTACK(a,UNIQUE(SORT(TOROW(FILTER(B2:B8,A2:A8=b)),,,1),1)))),1),"")
Thanks a lot, Peter. It is helpful.

What if we want to group the output by the unique value in column A, and unique value in row of A


1725485251447.png
 
Upvote 0
The requirements are changing quite a bit from the original thread. I suggest that you start a new thread and set out your requirements there.
I also suggest that you provide some usable* sample data and the expected results and explain in relation to the sample data.

* MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.

If you have trouble with XL2BB, review the "XL2BB Icons greyed out" link in the 'Known XL2BB issues' section near the top of the XL2BB Instructions page linked above.
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,107
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