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.
 
I don't think you've explained what you're looking for well. Can you explain in words what you're trying to do?
Yes so I'm trying to build a depreciation waterfall using the reducing balance method so I need to sum the waterfall by row only. So this formula works well "=MAP(H10#,LAMBDA(x,SUM(H10:x)))" but I need "H10" to move down to H11, then H12 and so forth instead of staying constant
 
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.
Please show an example of your requirement complete with expected results.

With legacy functions, an example (guess) follows:


Scan.xlsm
ABCDEFGHIJKLM
1
2125.008%5.009.608.838.137.486.886.335.82
310,000.0030%1,500.002,550.001,785.001,249.50874.65612.26428.58300.00
420,000.0020%2,000.003,600.002,880.002,304.001,843.201,474.561,179.65943.72
5Total3,505.006,159.604,673.833,561.632,725.332,093.701,614.561,249.54
1d
Cell Formulas
RangeFormula
G2:M4G2=ROUND(($B2-SUM($F2:F2))*$C2,2)
F2:F4F2=B2*C2/2
F5:M5F5=BYCOL(F2:M4,SUM)
Dynamic array formulas.
 
Upvote 0
okay so this formula "=MAP(H10#,LAMBDA(x,SUM(H10:x)))" works well but I need "H10" within the sum to move down to H11, then H12 and so forth instead of staying constant, is that possible?
I'm not sure what you need. can you post expected results?
 
Upvote 0
I'm not sure what you need. can you post expected results?
Hi sure so here what I'm trying to achieve highlighted in yellow using dynamic arrays

Gators.xlsx
KLMNO
55
565.008.898.237.627.06
570.005.008.237.627.06
580.000.006.009.629.06
590.000.000.006.009.06
600.000.000.000.006.00
615.0013.8922.4630.8638.23
62774.4885.511,013.051,132.191,243.96
63
64THIS IS WHAT I'M TRYING TO ACHIEVE
655.008.898.237.627.06
660.005.008.898.237.62
670.000.006.0010.679.88
680.000.000.006.0010.67
690.000.000.000.006.00
70
71
Schedules
Cell Formulas
RangeFormula
K56:O60K56=IFS(K9#<B56#,0,K9#=B56#,K53#*$G$50/2,K9#>B56#,(G56#-MAP(K56:O56,LAMBDA(x,SUM(K56:x))))*$G$50)
K61:O61K61=BYCOL(K56#,LAMBDA(a,SUM(a)))
K62:O62K62=K54#-K61#
K65:O69K65=IF(K$9<$B56,0,IF(K$9=$B56,$G56*$G$50/2,($G56-SUM($K65:K65))*$G$50))
Dynamic array formulas.
 
Upvote 0
The expected results are shown in #9 but with an array instead of a drag formula.
the results in #9 also could be done with a single REDUCE function.
工作簿1
ABCDEFGHI
10.08
2
3
4
5
6
7
820231255.00<-Initialvalue5.00TRUE
99.609.60TRUE
108.838.83TRUE
118.138.13TRUE
127.487.48TRUE
136.886.88TRUE
14
Sheet2
Cell Formulas
RangeFormula
G8:G13G8=REDUCE(D8,ROW(1:5),LAMBDA(x,y,VSTACK(x,(B8-SUM(x))*B1)))
D8D8=$B$8*$B$1/2
D9:D13D9=($B$8-SUM($D$8:D8))*$B$1
H8:H13H8=G8=D8
Dynamic array formulas.
 
Upvote 0
Hi sure so here what I'm trying to achieve highlighted in yellow using dynamic arrays

Gators.xlsx
KLMNO
55
565.008.898.237.627.06
570.005.008.237.627.06
580.000.006.009.629.06
590.000.000.006.009.06
600.000.000.000.006.00
615.0013.8922.4630.8638.23
62774.4885.511,013.051,132.191,243.96
63
64THIS IS WHAT I'M TRYING TO ACHIEVE
655.008.898.237.627.06
660.005.008.898.237.62
670.000.006.0010.679.88
680.000.000.006.0010.67
690.000.000.000.006.00
70
71
Schedules
Cell Formulas
RangeFormula
K56:O60K56=IFS(K9#<B56#,0,K9#=B56#,K53#*$G$50/2,K9#>B56#,(G56#-MAP(K56:O56,LAMBDA(x,SUM(K56:x))))*$G$50)
K61:O61K61=BYCOL(K56#,LAMBDA(a,SUM(a)))
K62:O62K62=K54#-K61#
K65:O69K65=IF(K$9<$B56,0,IF(K$9=$B56,$G56*$G$50/2,($G56-SUM($K65:K65))*$G$50))
Dynamic array formulas.
you just copied part of the worksheet, i can't copy them.
 
Upvote 0
Oh my mistake.

Sample.xlsx
FGHIJKLMNO
47202220232024202520262027
48
498.00%
50
51654.4722.05785.00858.62919.27
5252.3548.1653.9158.4964.01
53602.0673.9731.1800.1855.3
54125.0125.00150.00150.00150.00
55727.0798.88881.08950.141,005.26
56
572023125.005.008.898.237.627.06
582024125.000.005.008.237.627.06
592025150.000.000.006.009.629.06
602026150.000.000.000.006.009.06
612027150.000.000.000.000.006.00
625.0013.8922.4630.8638.23
63654.40722.0785.00858.62919.27967.04
64
65THIS IS WHAT I'M TRYING TO ACHIEVE
665.008.898.237.627.06
670.005.008.898.237.62
680.000.006.0010.679.88
690.000.000.006.0010.67
700.000.000.000.006.00
71
Schedules
Cell Formulas
RangeFormula
K47:O47K47=SEQUENCE(,years,start)
G49G49='Assumptions '!G39
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)
K62:O62K62=BYCOL(K57#,LAMBDA(a,SUM(a)))
J63J63=Model!I96
K63:O63K63=K55#-K62#
K66:O70K66=IF(K$47<$F57,0,IF(K$47=$F57,$G57*$G$49/2,($G57-SUM($K66:K66))*$G$49))
Dynamic array formulas.
Named Ranges
NameRefers ToCells
start='Assumptions '!$H$8K51:K52, K47
years='Assumptions '!$H$9K47
 
Upvote 0
Oh my mistake.

Sample.xlsx
FGHIJKLMNO
47202220232024202520262027
48
498.00%
50
51654.4722.05785.00858.62919.27
5252.3548.1653.9158.4964.01
53602.0673.9731.1800.1855.3
54125.0125.00150.00150.00150.00
55727.0798.88881.08950.141,005.26
56
572023125.005.008.898.237.627.06
582024125.000.005.008.237.627.06
592025150.000.000.006.009.629.06
602026150.000.000.000.006.009.06
612027150.000.000.000.000.006.00
625.0013.8922.4630.8638.23
63654.40722.0785.00858.62919.27967.04
64
65THIS IS WHAT I'M TRYING TO ACHIEVE
665.008.898.237.627.06
670.005.008.898.237.62
680.000.006.0010.679.88
690.000.000.006.0010.67
700.000.000.000.006.00
71
Schedules
Cell Formulas
RangeFormula
K47:O47K47=SEQUENCE(,years,start)
G49G49='Assumptions '!G39
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)
K62:O62K62=BYCOL(K57#,LAMBDA(a,SUM(a)))
J63J63=Model!I96
K63:O63K63=K55#-K62#
K66:O70K66=IF(K$47<$F57,0,IF(K$47=$F57,$G57*$G$49/2,($G57-SUM($K66:K66))*$G$49))
Dynamic array formulas.
Named Ranges
NameRefers ToCells
start='Assumptions '!$H$8K51:K52, K47
years='Assumptions '!$H$9K47
How to calculate 8.89 in L66? there could be a circular reference error.
 
Upvote 0
How to calculate 8.89 in L66? there could be a circular reference error.
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
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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