Dynamic arrays, circular arguments and all I want to due is increment a previous number

vampsthevampyre

New Member
Joined
Apr 29, 2016
Messages
29
Office Version
  1. 365
Platform
  1. Windows
Can anybody help, or is it just impossible what I'm asking excel to do.

What I'm looking to do, which the below sheet doesn't really so properly is as follows.

I have a table or dynamic array that has roulette numbers 0-36 and what I'm looking to do is have each number 0-36 in its own column that starts with number 36 and then increments by one on each number that is not the column header. If a number that matches the column header then the count resets to zero and then continues to increment as described above.

Every time I try to reference the previous numbers I'm getting a circular argument. Do I keep trying or is what I'm asking impossible to do.

Regards

Ian

roulette.xlsx
BCDEFGHI
3
40123
5Results036363636
6313737370
72923838381
8733939392
91144040403
10354141410
11964242421
123474343432
131384444443
143594545454
159104646465
163114747470
1715124848481
1812134949492
1928145050503
209155151514
2119165252525
227175353536
23218545407
242419555518
251820565629
2634215757310
276225858411
2823235959512
296246060613
3026256161714
3120266262815
Sheet1
Cell Formulas
RangeFormula
D5:D31D5=SEQUENCE(COUNT(Table18[Results])+1,,0)
Dynamic array formulas.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
How about
Fluff.xlsm
BCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAP
3
40123456789101112131415161718192021222324252627282930313233343536
5Results036363636363636363636363636363636363636363636363636363636363636363636363636
6313737370373737373737373737373737373737373737373737373737373737373737373737
7292383838138383838383838383838383838383838383838383838383838038383838383838
87339393923939390393939393939393939393939393939393939393939139393939393939
91144040403404040140404004040404040404040404040404040404040240404040404040
10354141410414141241414114141414141414141414141414141414141341414141414141
1196424242142424234204224242424242424242424242424242424242442424242424242
1234743434324343434431433434343434343434343434343434343434354343434304343
131384444443444444544244444044444444444444444444444444444464444444414444
14359454545445454564534554514545454545454545454545454545457454545452045
15910464646546464674604664624646464646464646464646464646468464646463146
16311474747047474784714774734747474747474747474747474747479474747474247
171512484848148484894824884844804848484848484848484848484810484848485348
181213494949249494910493499054914949494949494949494949494911494949496449
192814505050350505011504501016502505050505050505050505050012505050507550
20915515151451515112510511127513515151515151515151515151113515151518651
21191652525255252521352152123852452525205252525252525252214525252529752
2271753535365353530532531349535535353153535353535353533155353535310853
2321854540754545415435414510546545454254545454545454544165454545411954
24241955551855555525545515611557555555355555555055555551755555555121055
2518205656295656563565561671256856560456565656156565661856565656131156
2634215757310575757457657178135795757155757575725757577195757575701257
276225858411585805587581891458105858265858585835858588205858585811358
2823235959512595916598591910155911595937595959045959599215959595921459
2962460606136060076096020111660126060486060601560606010226060606031560
30262561617146161186110612112176113616159616161266106111236161616141661
31202662628156262296211622213186214626261006262376216212246262626251762
Sheet5
Cell Formulas
RangeFormula
F4:AP31F4=LET(n,SEQUENCE(,37,0),VSTACK(n,SEQUENCE(,37,36,0),DROP(REDUCE("",n,LAMBDA(x,y,HSTACK(x,SCAN(36,Table18[Results],LAMBDA(a,b,IF(b=y,0,a+1)))))),,1)))
D5:D31D5=SEQUENCE(COUNT(Table18[Results])+1,,0)
Dynamic array formulas.
 
Upvote 0
This is basically an extract of @Fluff's suggestion but simplifies the main formula a bit by removing the creation of the headings in F4, G4, .. (as it seemed to me that they might already be there anyway) & also removing the separate creation of the row of "36" values in row 5.
Anyway, I needed the practice at this sort of formula so it is presented as a possible option.
(If the headings in row 4 are already there but not produced by a spill formula as I have, then in the F5 formula, replace F4# with F4:AP4)

vampsthevampyre.xlsm
BCFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAP
40123456789101112131415161718192021222324252627282930313233343536
5Results36363636363636363636363636363636363636363636363636363636363636363636363636
633737370373737373737373737373737373737373737373737373737373737373737373737
729383838138383838383838383838383838383838383838383838383838038383838383838
8739393923939390393939393939393939393939393939393939393939139393939393939
9114040403404040140404004040404040404040404040404040404040240404040404040
1034141410414141241414114141414141414141414141414141414141341414141414141
119424242142424234204224242424242424242424242424242424242442424242424242
123443434324343434431433434343434343434343434343434343434354343434304343
13134444443444444544244444044444444444444444444444444444464444444414444
1435454545445454564534554514545454545454545454545454545457454545452045
159464646546464674604664624646464646464646464646464646468464646463146
163474747047474784714774734747474747474747474747474747479474747474247
1715484848148484894824884844804848484848484848484848484810484848485348
1812494949249494910493499054914949494949494949494949494911494949496449
1928505050350505011504501016502505050505050505050505050012505050507550
209515151451515112510511127513515151515151515151515151113515151518651
211952525255252521352152123852452525205252525252525252214525252529752
22753535365353530532531349535535353153535353535353533155353535310853
23254540754545415435414510546545454254545454545454544165454545411954
242455551855555525545515611557555555355555555055555551755555555121055
25185656295656563565561671256856560456565656156565661856565656131156
26345757310575757457657178135795757155757575725757577195757575701257
2765858411585805587581891458105858265858585835858588205858585811358
28235959512595916598591910155911595937595959045959599215959595921459
29660606136060076096020111660126060486060601560606010226060606031560
302661617146161186110612112176113616159616161266106111236161616141661
312062628156262296211622213186214626261006262376216212246262626251762
Sheet3
Cell Formulas
RangeFormula
F4:AP4F4=SEQUENCE(,37,0)
F5:AP31F5=DROP(REDUCE("",F4#,LAMBDA(x,y,HSTACK(x,SCAN(35,Table18[[#All],[Results]],LAMBDA(a,b,(a+1)*(b<>y)))))),,1)
Dynamic array formulas.
 
Upvote 0
It's also possible to scan by column without REDUCE. Simply flip the array on its side with TRANSPOSE (because SCAN works in row major order), use an appropriate logical test to reset the scan at either the start or end of each row, then TRANSPOSE the results again to return the original orientation. For this particular scenario, the following should work:

Excel Formula:
=LET(
    n, SEQUENCE(,37,0),
    VSTACK(n,TRANSPOSE(SCAN(0,TRANSPOSE(VSTACK(n,Table18[Results]<>n)),LAMBDA(a,v,IF(ISNUMBER(v),36,(a+1)*v)))))
)
 
Upvote 0

Forum statistics

Threads
1,223,792
Messages
6,174,612
Members
452,574
Latest member
hang_and_bang

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