Spill dynamic array across multiple columns with a defined depth

EMoscosoCam

New Member
Joined
Nov 3, 2011
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hello

Is it possible to distribute a dynamic array into multiple columns? For example, consider an array with 22 values, and you want to spill the values in sequence across 6 columns with a maximum row count of 4:

DynamicArrayMatrix.png

In this example a have put numbers in sequence for the sake of simplicity, but my real array is made of texts.


Thanks!
 
Last edited:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
What version of Excel are you using (update profile to show that)? If you're using Excel 365, look into WRAPROWS and WRAPCOLS.
MrExcel_20220826.xlsx
ABCDEFGH
1
2aabc
3bdef
4cghi
5djk
6e
7f
8gadgj
9hbehk
10icfi
11j
12k
13acegik
14bdfhj
15
Sheet7
Cell Formulas
RangeFormula
C2:E5C2=WRAPROWS(A2:A12,3,"")
C8:F10C8=WRAPCOLS(A2:A12,3,"")
C13:H14C13=WRAPCOLS(A2:A12,ROUNDUP(COUNTA(A2:A12)/6,0),"")
Dynamic array formulas.


Edited to show how to force 6 columns in last example.
 
Upvote 0
You might need to experiment as those functions have some odd behavior (at least to me it seems that way). If you have 22 values, have a look at the last example below:
MrExcel_20220826.xlsx
ABCDEFGH
2aabc
3bdef
4cghi
5djk
6e
7f
8gadgj
9hbehk
10icfi
11j
12kaeimqu
13lbfjnrv
14mcgkos
15ndhlpt
16o
17p
18q
19r
20s
21t
22u
23v
Sheet7
Cell Formulas
RangeFormula
C2:E5C2=WRAPROWS(A2:A12,3,"")
C8:F10C8=WRAPCOLS(A2:A12,3,"")
C12:H15C12=WRAPCOLS(A2:A23,CEILING(COUNTA(A2:A23),6)/6,"")
Dynamic array formulas.
 
Upvote 0
Thanks a lot! The functions WRAPCOLS() and WRAPROWS() are in the "Office Insider Beta", I don't have it yet (Excel 365 v2206). However, it seems that they have just what I need.
 
Upvote 0
Easier with WRAPROWS, but not terribly hard without it:

Book1
ABCDEFGH
1ArrayColumn1Column2Column3Column4Column5Column6
21159131721
322610141822
4337111519
5448121620
65
76
87
98
109
1110
1211
1312
1413
1514
1615
1716
1817
1918
2019
2120
2221
2322
24
Sheet1
Cell Formulas
RangeFormula
A2:A23A2=SEQUENCE(22)
C2:H5C2=IFERROR(INDEX(A2#,TRANSPOSE(SEQUENCE(ROUNDUP(ROWS(A2#)/4,0),4))),"")
Dynamic array formulas.
 
Upvote 0
Another way

22 08 28.xlsm
ABCDEFGH
1Array
21159131721
322610141822
4337111519
5448121620
65
76
87
98
109
1110
1211
1312
1413
1514
1615
1716
1817
1918
2019
2120
2221
2322
24
MAKEARRAY
Cell Formulas
RangeFormula
A2:A23A2=SEQUENCE(22)
C2:H5C2=LET(rws,4,MAKEARRAY(rws,6,LAMBDA(r,c,IFERROR(INDEX(A2#,(c-1)*rws+r),""))))
Dynamic array formulas.
 
Upvote 0
The functions WRAPCOLS() and WRAPROWS() are in the "Office Insider Beta", I don't have it yet (Excel 365 v2206).
They have now been released to the monthly channel, I got them on Friday & am on v2207 so if you run an update you may get them.
 
Upvote 0
They have now been released to the monthly channel, I got them on Friday & am on v2207 so if you run an update you may get them.
Thanks! I am also in the monthly channel and I have just passed from 2205 to 2206. Maybe is a region thing, but good to know the the rollout is coming
 
Upvote 0
Thanks a lot for your answers! Using Eric W answer as a base, I wrote a WRAPROWS() imitation:

= LAMBDA(vector, wrap_count, IFERROR(INDEX(vector, TRANSPOSE(SEQUENCE(ROUNDUP(ROWS(vector)/wrap_count,0), wrap_count))),""))
 
Upvote 0
Thanks for the update describing the LAMBDA variant. I'm in the monthly channel and updated this past Thursday to v2207 (similar to @Fluff)...looks like WRAPROWS, WRAPCOLS, and several other functions (e.g., HSTACK and VSTACK) were included.
 
Upvote 0

Forum statistics

Threads
1,223,630
Messages
6,173,453
Members
452,514
Latest member
cjkelly15

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