Array of repeatn

kcmuppet

Active Member
Joined
Nov 2, 2005
Messages
437
Office Version
  1. 365
Platform
  1. Windows
[I accidentally hit some keystroke which posted this post before I was ready, so can't seem to edit the subject. Anyway, in case you're somehow reading this post...

How can I achieve what the formula in E23 is doing, more simply?

i.e. repeat the number in E20, the number of times given in the cell below, then the number in F20 repeated the number of times in the cell below, and so on (I have about 30 columns).



CBC2 Conjoint Simulator v0-1.xlsx
EFGHIJKLM
2012
2163
22
23111111222
Lists
Cell Formulas
RangeFormula
E21E21=COUNTA(tb_Attribute1_levels[Attribute1_levels])
F21F21=COUNTA(tb_Attribute2_levels[Attribute2_levels])
E23:M23E23=HSTACK(SEQUENCE(1,E8,E7,0),SEQUENCE(1,F8,F7,0))
Dynamic array formulas.
Named Ranges
NameRefers ToCells
Attribute1_levels=tb_Attribute1_levels[Attribute1_levels]E21
Attribute2_levels=tb_Attribute2_levels[Attribute2_levels]F21
 
Last edited:

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Any chance you could explain exactly what you are after.
Rather than posting meaningless formulae that look at cells you haven't shown.
 
Upvote 0
Any chance you could explain exactly what you are after.
Rather than posting meaningless formulae that look at cells you haven't shown.


I accidentally hit some keystroke which posted this post before I was ready, and now can't seem to edit the title....
 
Upvote 0
Just post an explanation of what you are trying to do.
 
Upvote 0
Maybe this if you're using 365, will not work on 2010:
Book1
EFGHIJKLMNOPQRST
201234
216325
221111112223344444
Sheet1
Cell Formulas
RangeFormula
E22:T22E22=LAMBDA(val,rpt,TRANSPOSE(XLOOKUP(SEQUENCE(SUM(rpt)),HSTACK(1,SCAN(1,rpt,LAMBDA(a,b,a+b))),HSTACK(val,""),,-1)))(E20:H20,E21:H21)
Dynamic array formulas.
 
Upvote 1
Solution
Many thanks, it works! My first sight of the Scan function. I'm going to try to work out how it works and how to make the last part dynamically extend to the number of non-blank cells in rows 20 &21
 
Upvote 0
Many thanks, it works! My first sight of the Scan function. I'm going to try to work out how it works and how to make the last part dynamically extend to the number of non-blank cells in rows 20 &21
You're welcome, and happy to help. I got it from here:
and learned most of it while I was at it. It is explained quite well. I added the TRANSPOSE and used HSTACK instead because of your data layout.
 
Upvote 1

Forum statistics

Threads
1,215,124
Messages
6,123,187
Members
449,090
Latest member
bes000

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