Creating an array based on number of elements -- MAKEARRAY?

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
20,615
Office Version
  1. 365
Platform
  1. Windows
First time trying using MAKEARRAY and I've never used LAMBDA either. Can you please help

If the number was 4
1​
5​
2​
6​
3​
7​
4​
8
If the number was 3, then I was going to use TOROW to get this {1,4,2,5,3,6}
1​
4​
2​
5​
3​
6​
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
I did not use MakeArray but consider the following

Book1
ABC
1
214
325
436
5
615
726
837
948
10
11
Sheet1
Cell Formulas
RangeFormula
B2:C4B2=HSTACK(SEQUENCE(3),SEQUENCE(3,,4))
B6:C9B6=HSTACK(SEQUENCE(4),SEQUENCE(4,,5))
Dynamic array formulas.
 
Upvote 0
If you're not just trying to learn how to use MAKEARRAY and LAMBDA, then these versions work too:

Book2
ABCDE
11515
22626
33737
44848
Sheet4
Cell Formulas
RangeFormula
A1:B4A1=TRANSPOSE(SEQUENCE(2,4))
D1:E4D1=SEQUENCE(4)+{0,4}
Dynamic array formulas.
 
Upvote 0
Solution
Scott, I believe you can use the below :
Book4
AB
115
226
337
448
5
614
725
836
Sheet1
Cell Formulas
RangeFormula
A1:B4A1=LET(a,4,MAKEARRAY(a, 2, LAMBDA(row,col, IF(col = 1, row, row + a))))
A6:B8A6=LET(a,3,MAKEARRAY(a, 2, LAMBDA(row,col, IF(col = 1, row, row + a))))
Dynamic array formulas.
 
Upvote 0
If you're not just trying to learn how to use MAKEARRAY and LAMBDA, then these versions work too:

Book2
ABCDE
11515
22626
33737
44848
Sheet4
Cell Formulas
RangeFormula
A1:B4A1=TRANSPOSE(SEQUENCE(2,4))
D1:E4D1=SEQUENCE(4)+{0,4}
Dynamic array formulas.

For my ultimate ending need of all this, I used:
=TOROW(TRANSPOSE(SEQUENCE(2,4)))

Book1
FGHIJKLM
615263748
Sheet1
Cell Formulas
RangeFormula
F6:M6F6=TOROW(TRANSPOSE(SEQUENCE(2,4)))
Dynamic array formulas.


Thanks for your help!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,334
Members
452,636
Latest member
laura12345

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