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:
Using Eric W answer as a base, I wrote a WRAPROWS() imitation:
Does that have an advantage over Eric's method (or the MAKEARRAY suggestion)? Is it just that the formula seen in the worksheet looks simpler?
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Does that have an advantage over Eric's method (or the MAKEARRAY suggestion)? Is it just that the formula seen in the worksheet looks simpler?
Using "MakeArray" you have to provide the number of rows and columns, with Eric's method you only provide the number of rows, and the number of columns increase as needed - which I believe is the same behaviour as the WrapRows() function. Furthermore, when using MakeArray and you pass a maximum of 6 columns, and the data needs 7, those items are ignored.
 
Upvote 0
Using "MakeArray" you have to provide the number of rows and columns,
Fair enough - though I hard-coded the 6 because your original question seemed to specify the 6 columns. :)

For the columns to be flexible it could be ..

Excel Formula:
=LET(rws,4,cols,ROUNDUP(ROWS(A2#)/rws,0),MAKEARRAY(rws,cols,LAMBDA(r,c,IFERROR(INDEX(A2#,(c-1)*rws+r),""))))

The basis of my question remains though
Does that have an advantage over Eric's method (or the MAKEARRAY suggestion)? a standard worksheet function formula that doesn't require the LAMBDA to be entered into the name manager? Is it just that the formula seen in the worksheet looks simpler?
 
Upvote 0
Fair enough - though I hard-coded the 6 because your original question seemed to specify the 6 columns. :)

For the columns to be flexible it could be ..

Excel Formula:
=LET(rws,4,cols,ROUNDUP(ROWS(A2#)/rws,0),MAKEARRAY(rws,cols,LAMBDA(r,c,IFERROR(INDEX(A2#,(c-1)*rws+r),""))))

The basis of my question remains though
Thanks for updating your formula! I wrote a custom function because it was simpler to use in the worksheet. What's more, I named it "F_WRAPROWS", so that when I finally got the roll-out I could easily change it. I must admit that I still have to understand either solution xD

= LAMBDA(vector, wrap_count, LET(rws, wrap_count,cols,ROUNDUP(ROWS(vector)/rws,0),MAKEARRAY(rws,cols,LAMBDA(r,c,IFERROR(INDEX(vector,(c-1)*rws+r),"")))))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
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