Cumulative sum in dynamic arrays

zn24

New Member
Joined
Apr 30, 2024
Messages
12
Office Version
  1. 365
Platform
  1. MacOS
Hi, I'm trying to do a cummulative sum within a dynamic array by each row. What I want to achieve is highlighted in blue with normal formulas. I would love your help with how I can achieve same with dynamic arrays. Thank you.

Cusum with DA.xlsx
EFGHIJKLMNO
5
6
7
8
9Dynamic array
100.50.70.30.90.3
110.30.70.51.00.9
120.90.60.30.50.6
130.90.21.00.80.4
140.40.50.40.60.2
15
16
17what I'm trying to achieve with ddynamic array
180.51.21.52.42.7
190.82.23.04.96.1
201.73.64.87.18.9
212.54.66.810.012.2
222.95.58.111.914.3
23
24
25
26
27
28
29
Sheet1
Cell Formulas
RangeFormula
H10:L14H10=RANDARRAY(5,5)
H18:L22H18=SUM($H$10:H10)
Dynamic array formulas.
 
Theres definitely an error there. I just recalculated manually and this should be correct i.e the yellow highlighted cells

Sample.xlsx
FGHIJKLMNOPQRSTU
47202220232024202520262027
48
498.00%
50MANUAL CALCULATION TO FIND ANS HIGHLIGHTED IN YELLOW
51654.4722.05785.00858.62919.27125.00120.00110.40101.5793.44
5252.3548.1653.9158.4964.015.009.608.838.137.48
53602.0673.9731.1800.1855.3
54125.0125.00150.00150.00150.00125.00120.00110.40101.57
55727.0798.88881.08950.141,005.265.009.608.838.13
56
572023125.005.008.898.237.627.06150.00144.00132.48
582024125.000.005.008.237.627.066.0011.5210.60
592025150.000.000.006.009.629.06
602026150.000.000.000.006.009.06150.00144.00
612027150.000.000.000.000.006.006.0011.52
625.0013.8922.4630.8638.23
63654.40722.0785.00858.62919.27967.04150.00
646.00
65THIS IS WHAT I'M TRYING TO ACHIEVE
665.009.608.838.137.485.009.608.838.137.48
670.005.009.608.838.130.005.009.608.838.13
680.000.006.0011.5210.600.000.006.0011.5210.60
690.000.000.006.0011.520.000.000.006.0011.52
700.000.000.000.006.000.000.000.000.006.00
71
Schedules
Cell Formulas
RangeFormula
K47:O47K47=SEQUENCE(,years,start)
G49G49='Assumptions '!G39
Q51Q51=K54
R51:U51,U60,T57:U57,S54:U54R51=Q51-Q52
Q52,U64,T61,S58,R55Q52=$G$49*Q51/2
R52:U52,U61,T58:U58,S55:U55R52=$G$49*R51
R54R54=K54
K51:O51K51=IF(K8#=start,J63,SUMIFS(K63#,K8#,K8#-1))
K52:O52K52=IF(K8#=start,G49*J63,SUMIFS(K53#,K8#,K8#-1)*G49)
K53:O53K53=K51#-K52#
K54:O54K54='Assumptions '!K35:O35
K55:O55K55=K53#+K54#
F57:F61F57=TRANSPOSE(K47#)
G57:G61G57=TRANSPOSE(K54#)
K57:O61K57=IFS(K47#<F57#,0,K47#=F57#,K54#*$G$49/2,K47#>F57#,(G57#-MAP(K57:O57,LAMBDA(x,SUM(K57:x))))*$G$49)
S57S57=G59
T60T60=G60
K62:O62K62=BYCOL(K57#,LAMBDA(a,SUM(a)))
J63J63=Model!I96
K63:O63K63=K55#-K62#
U63U63=G61
K66:O66K66=Q52:U52
K67:O67K67=Q55:U55
K68:O68K68=Q58:U58
K69:O69K69=Q61:U61
K70:O70K70=Q64:U64
Q66:U66Q66=Q52:U52
Q67:U67Q67=Q55:U55
Q68:U68Q68=Q58:U58
Q69:U69Q69=Q61:U61
Q70:U70Q70=Q64:U64
Dynamic array formulas.
Named Ranges
NameRefers ToCells
start='Assumptions '!$H$8K51:K52, K47
years='Assumptions '!$H$9K47
工作簿1.xlsx
ABCDEFGHIJK
1202220232024202520262027
2
38%
4
5654.40722.05785.00858.62919.27
652.3548.1653.9158.4964.01
7602.00673.90731.11800.10855.30
8125.00125.00150.00150.00150.00
9727.00798.88881.08950.141,005.26
10
1120231255.008.898.237.627.06
122024125-5.008.237,362.007.06
132025150--6.009.629.06
142026150---6.009.06
152027150----6.00
165.0013.8930.8630.8638.23
17654.40722.00785.00919.27919.27967.04
18
19
205.009.608.838.137.48
21-5.009.608.838.13
22--6.0011.5210.60
23---6.0011.52
24----6.00
25
Sheet3
Cell Formulas
RangeFormula
F20:J24F20=DROP(REDUCE(B11:B15*0,F1:J1,LAMBDA(x,y,HSTACK(x,IFS(y<A11:A15,,y=A11:A15,B11:B15*B3/2,1,(B11:B15-BYROW(x,LAMBDA(z,SUM(z))))*B3)))),,1)
Dynamic array formulas.
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
if you registered beta channel, you can use eta-reduced lambda in the formula.
工作簿1.xlsx
ABCDEFGHIJK
1202220232024202520262027
2
38%
4
5654.40722.05785.00858.62919.27
652.3548.1653.9158.4964.01
7602.00673.90731.11800.10855.30
8125.00125.00150.00150.00150.00
9727.00798.88881.08950.141,005.26
10
1120231255.008.898.237.627.06
122024125-5.008.237,362.007.06
132025150--6.009.629.06
142026150---6.009.06
152027150----6.00
165.0013.8930.8630.8638.23
17654.40722.00785.00919.27919.27967.04
18
19
205.009.608.838.137.48
21-5.009.608.838.13
22--6.0011.5210.60
23---6.0011.52
24----6.00
25
Sheet3
Cell Formulas
RangeFormula
F20:J24F20=DROP(REDUCE(B11:B15*0,F1:J1,LAMBDA(x,y,HSTACK(x,IFS(y<A11:A15,,y=A11:A15,B11:B15*B3/2,1,(B11:B15-BYROW(x,SUM))*B3)))),,1)
Dynamic array formulas.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,882
Messages
6,175,166
Members
452,615
Latest member
bogeys2birdies

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