Create one-dimensional array from single cell (repeating that cells value n times)

kderoeck

New Member
Joined
Oct 24, 2012
Messages
6
Hi,

I'm looking for an excel formula that can create a one-dimensional array from a single cell, repeating the cells value n times. e.g. cell A1 has value 200, the result of the formula should be an array that looks like this: {200,200,200,200,200,200,200}

The challenge lies in the fact that I would like to avoid using VBA as I'm pretty sure the same result can be achieved through excel formulas.

Kind regards,
Koen
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
What are you going to use the array for? That might open up some other options.
 
Upvote 0
Hi Andrew,

Great! Thank you very much! This formula gives me the result I was looking for.

Any idea why I cannot use your formula in conjucntion with a sumproduct?

e.g. =SUMPRODUCT(INDEX((A1*ROW(1:7))/ROW(1:7),),C2:G2)

The underlying idea is that I want to apply seasonality (range C2:G2) onto a flat forecast (A1)

Kind regards,
Koen
 
Upvote 0
There are only 5 columns in C:G. But you don't need to got to those lengths. If you multiply within SUMPRODUCT it will be expanded automatically:

=SUMPRODUCT(C2:G2*A1)
 
Upvote 0
hi Andrew:

I understand this is an old post but I thought I might give it a shot at asking it in this context instead of creating a new thread. I am looking for a way to create a dynamic array constant which has the value of {1,1,1;2,2,0;3,0,0} in column 3 and {1,1,1,1;2,2,2,0;3,3,0,0;4,0,0,0} in column 4.. and so on and so forth

This is where I have reached so far:
I was able to figure out that an array formula =CHOOSE(TRANSPOSE(A1:C1),{1,1,1},{2,2,0},{3,0,0}) where A1=1,B1=2,C1=3 gives me the solution and =A1*--(A1:A3<D1) gives me the value of {1,1,1}.. but when I try combining the above two into a single forumla as =CHOOSE(TRANSPOSE(A1:C1),A1:C1*--(OFFSET(A1:C1,0,0,1,C1)<D1)).. i am returned the value of {1,2,3;#VALUE!,#VALUE!,#VALUE!;#VALUE!,#VALUE!,#VALUE!}....

I cant seem to figure out how to get this to work or some other way to get the constant {1,1,1;2,2,0;3,0,0}.

Please do help.

Thanks
Akshay
 
Upvote 0
Akshay
Now, with dynamic array formula ...
=IF(MOD(SEQUENCE(A1,A1)-1,A1)+INT(SEQUENCE(A1,A1,0)/A1)>=A1,0,INT(SEQUENCE(A1,A1,0)/A1)+1)
where a1 is the column number
 
Upvote 0
Akshay
Now, with dynamic array formula ...
=IF(MOD(SEQUENCE(A1,A1)-1,A1)+INT(SEQUENCE(A1,A1,0)/A1)>=A1,0,INT(SEQUENCE(A1,A1,0)/A1)+1)
where a1 is the column number
Thanks Kipperfer, can this be done without a sequence command? the desktop version of excel dont seem to have this command!
 
Upvote 0
the desktop version of excel dont seem to have this command!
It depends on which desktop version you have. Therefore ..

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
eg
1624520126298.png
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,021
Members
452,374
Latest member
keccles

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