SOLVED

Series on excel

%3CLINGO-SUB%20id%3D%22lingo-sub-1761754%22%20slang%3D%22en-US%22%3ESeries%20on%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1761754%22%20slang%3D%22en-US%22%3EI%20have%20a%20value%2C%20100%20for%20example%20and%20a%20rate%20(5%25)%20with%20a%20period%20on%203%20years%20and%20use%2090%25%20of%20the%20result.%20I%20need%20to%20recreate%20this%20formula%3CBR%20%2F%3E(100%2F3*((1%2B5%25)%C2%B3-1)%2B100%2F3*((1%2B5%25)%C2%B2-1)%2B100%2F3*((1%2B5%25)-1)*90%25%3CBR%20%2F%3ESo%20if%20i%20change%20the%20period%2C%20it%20automatically%20return%20the%20value%3CBR%20%2F%3Elike%20this%20if%20n%20%3D%202%3CBR%20%2F%3E100%2F2*((1%2B5%25)%C2%B2-1)%2B100%2F2*((1%2B5%25)-1)*90%25%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1761754%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1761846%22%20slang%3D%22en-US%22%3ERe%3A%20Series%20on%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1761846%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F825476%22%20target%3D%22_blank%22%3E%40HvgoCA%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20is%20a%20custom%20VBA%20function%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-visual%22%3E%3CCODE%3EFunction%20Outcome(Amount%20As%20Double%2C%20Rate%20As%20Double%2C%20Periods%20As%20Long)%20As%20Double%0A%20%20%20%20Dim%20i%20As%20Long%0A%20%20%20%20Dim%20x%20As%20Double%0A%20%20%20%20Dim%20r%20As%20Double%0A%20%20%20%20x%20%3D%201%20%2B%20Rate%0A%20%20%20%20For%20i%20%3D%201%20To%20Periods%0A%20%20%20%20%20%20%20%20r%20%3D%20r%20%2B%20x%20%5E%20i%20-%201%0A%20%20%20%20Next%20i%0A%20%20%20%20Outcome%20%3D%20r%20*%20Amount%20%2F%20Periods%20*%200.9%0AEnd%20Function%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EUse%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%3DOutcome(100%2C5%25%2C3)%3C%2FP%3E%0A%3CP%3Eor%20enter%20the%20input%20values%20in%20cells%2C%20for%20example%20A1%2C%20A2%20and%20A3%3A%3C%2FP%3E%0A%3CP%3E%3DOutcome(A1%2CA2%2CA3)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1761997%22%20slang%3D%22en-US%22%3ERe%3A%20Series%20on%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1761997%22%20slang%3D%22en-US%22%3E%3CP%3EWorks%20as%20expected!!!!%20Many%20thanks!!!%2C%20very%20quick%20response%2C%20i%20reaaally%20appreciate%20your%20help%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1762748%22%20slang%3D%22en-US%22%3ERe%3A%20Series%20on%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1762748%22%20slang%3D%22en-US%22%3EIt's%20very%20simple%20put%20the%20value%20of%20n%20in%20any%20cell%20and%20use%20the%20cell%20address%2Freferences%20in%20the%20formula%20for%20example%2C%2C%2C%3CBR%20%2F%3E%3CBR%20%2F%3ESuppose%20in%20cell%20A1%20you%20kept%20value%20of%20n%2C%2C%20then%20this%20would%20be%20the%20formula.%3CBR%20%2F%3E%3CBR%20%2F%3E%3D100%2F%24A%241*((1%2B5%25)%C2%B2-1)%2B100%2F%24A%241*((1%2B5%25)-1)*90%25%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1762876%22%20slang%3D%22en-US%22%3ERe%3A%20Series%20on%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1762876%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F825476%22%20target%3D%22_blank%22%3E%40HvgoCA%3C%2FA%3E%26nbsp%3BAs%20a%20variant%2C%20and%20if%20you%20are%20on%20a%20recent%20version%20of%20Excel%2C%20please%20find%20a%20formula%20in%20the%20attached%20workbook%2C%20using%20the%20SEQUENCE%20function.%20No%20VBA%20required.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEdit%3A%20updated%20file!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1763833%22%20slang%3D%22en-US%22%3ERe%3A%20Series%20on%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1763833%22%20slang%3D%22en-US%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F93699%22%20target%3D%22_blank%22%3E%40Rajesh-S%3C%2FA%3E%20its%20not%20that%20simple%2C%20the%20idea%20is%20that%20when%20you%20change%20the%20value%20of%20%22n%22%20on%20a%20cel%20it%20changes%20the%20lengh%20of%20the%20entire%20ecuation%3A%20for%20example%3A%3CBR%20%2F%3Er%20%3D%20100%3CBR%20%2F%3En%20%3D%204%3CBR%20%2F%3Ei%20%3D%203%25%3CBR%20%2F%3Ethen%20you%20get%3A%3CBR%20%2F%3Ex%20%3D%20((100%2F4(((1%2B0.03)%5E4)-1)%2B(100%2F4(((1%2B0.03)%5E3)-1)%2B(100%2F4(((1%2B0.03)%5E2)-1)%2B(100%2F4(((1%2B0.03)%5E1)-1))*0.90%3CBR%20%2F%3Eand%20goes%20on%20larger%20or%20smaller%20while%20changing%20n.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1763881%22%20slang%3D%22en-US%22%3ERe%3A%20Series%20on%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1763881%22%20slang%3D%22en-US%22%3EOh%20Great!!%2C%20this%20works%20too%2C%20i'll%20use%20it%20too%2C%20thanks!.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1766802%22%20slang%3D%22en-US%22%3ERe%3A%20Series%20on%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1766802%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F825476%22%20target%3D%22_blank%22%3E%40HvgoCA%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheck%20this%2C%20I've%20put%20value%20of%20n%2C%20r%20%26amp%3B%20i%20in%20cells%20F15%2C%20F17%20%26amp%3B%20in%20F18.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Rajesh-S_0-1602308612947.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F225700i69EE0EC6AC835783%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Rajesh-S_0-1602308612947.png%22%20alt%3D%22Rajesh-S_0-1602308612947.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CUL%3E%3CLI%3EYour%20formula%20in%20in%20cell%20I15%3A%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%3D((100%2F4*(((1%2B0.03)%5E4)-1)%2B(100%2F4*(((1%2B0.03)%5E3)-1)%2B(100%2F4*(((1%2B0.03)%5E2)-1)%2B(100%2F4*(((1%2B0.03)%5E1)-1))*0.9))))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3EMy%20formula%20is%20in%20cell%20I18%3A%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3D((%24F%2417%2F%24F%2415*(((1%2B%24F%2418)%5E4)-1)%2B(%24F%2417%2F%24F%2415*(((1%2B%24F%2418)%5E3)-1)%2B(%24F%2417%2F%24F%2415*(((1%2B%24F%2418)%5E2)-1)%2B(%24F%2417%2F%24F%2415*(((1%2B%24F%2418)%5E1)-1))*0.9))))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnd%20both%20produces%20same%20results.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CEM%3ERemember%20whenever%20you%20are%20using%20cell%20references%20in%20the%20formula%2C%20Excel%20makes%20the%20formula%26nbsp%3B%20dynamic%2C%20and%20change%20value%20in%20cell%20depends%20on%20situation%2C%20if%20and%20when%20required%20or%20not.%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1766842%22%20slang%3D%22en-US%22%3ERe%3A%20Series%20on%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1766842%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F93699%22%20target%3D%22_blank%22%3E%40Rajesh-S%3C%2FA%3E%26nbsp%3BAllow%20me%20to%20comment%3A%20The%20point%20is%20that%20the%20number%20of%20times%20the%20part%20%22(1%2B%25)%5En%22%20needs%20to%20be%20included%2C%20varies%20with%20the%20number%20of%20periods.%20Therefore%20you%20cannot%20build%20a%20static%20formula%20that%20includes%20a%20fixed%20number%20of%20these%20calculations.%20If%20there%20are%20only%20two%20periods%2C%20it%20would%20be%26nbsp%3B%22(1%2B%25)%5E2%20%2B%20(1%2B%25)%5E1%22.%20Six%20periods%20would%20be%20%22(1%2B%25)%5E6%20%2B%26nbsp%3B(1%2B%25)%5E5%20........%20%2B%26nbsp%3B(1%2B%25)%5E1%22.%3C%2FP%3E%3CP%3EYou'll%20need%20a%20UDF%20or%20DA%20formula%20as%20demonstrated%20above.%20Try%20this%3A%20change%20the%20number%20of%20periods%20to%206%20but%20DO%20NOT%20edit%20your%20formula!%20You'll%20see%20it%20won't%20work.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1767026%22%20slang%3D%22en-US%22%3ERe%3A%20Series%20on%20excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1767026%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F825476%22%20target%3D%22_blank%22%3E%40HvgoCA%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20could%20either%20follow%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3Bsolution%20of%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3D%20(base*factor%2Fn)%20*%20SUM((1%2Bperc)%5Ek%20-%201)%0Awhere%20k%20is%0A%3DSEQUENCE(n)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Eor%20you%20could%20bite%20the%20bullet%20and%20sum%20the%20geometric%20series%20algebraically%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3D%20(base*factor%2Fn)%20*%20(((1%2Bperc)%5En%20-%201)*(1%2Bperc)%2Fperc%20-%20n)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor
I have a value, 100 for example and a rate (5%) with a period on 3 years and use 90% of the result. I need to recreate this formula
(100/3*((1+5%)³-1)+100/3*((1+5%)²-1)+100/3*((1+5%)-1)*90%
So if i change the period, it automatically return the value
like this if n = 2
100/2*((1+5%)²-1)+100/2*((1+5%)-1)*90%
12 Replies
Highlighted

@HvgoCA 

Here is a custom VBA function:

Function Outcome(Amount As Double, Rate As Double, Periods As Long) As Double
    Dim i As Long
    Dim x As Double
    Dim r As Double
    x = 1 + Rate
    For i = 1 To Periods
        r = r + x ^ i - 1
    Next i
    Outcome = r * Amount / Periods * 0.9
End Function

Use like this:

=Outcome(100,5%,3)

or enter the input values in cells, for example A1, A2 and A3:

=Outcome(A1,A2,A3)

Highlighted

Works as expected!!!! Many thanks!!!, very quick response, i reaaally appreciate your help @Hans Vogelaar 

Highlighted
It's very simple put the value of n in any cell and use the cell address/references in the formula for example,,,

Suppose in cell A1 you kept value of n,, then this would be the formula.

=100/$A$1*((1+5%)²-1)+100/$A$1*((1+5%)-1)*90%
Highlighted
Best Response confirmed by HvgoCA (New Contributor)
Solution

@HvgoCA As a variant, and if you are on a recent version of Excel, please find a formula in the attached workbook, using the SEQUENCE function. No VBA required.

 

Edit: updated file!

Highlighted
@Rajesh-S its not that simple, the idea is that when you change the value of "n" on a cel it changes the lengh of the entire ecuation: for example:
r = 100
n = 4
i = 3%
then you get:
x = ((100/4(((1+0.03)^4)-1)+(100/4(((1+0.03)^3)-1)+(100/4(((1+0.03)^2)-1)+(100/4(((1+0.03)^1)-1))*0.90
and goes on larger or smaller while changing n.
Highlighted
Oh Great!!, this works too, i'll use it too, thanks!.
Highlighted

@HvgoCA 

 

Check this, I've put value of n, r & i in cells F15, F17 & in F18.

 

Rajesh-S_0-1602308612947.png

  • Your formula in in cell I15:

 

 

=((100/4*(((1+0.03)^4)-1)+(100/4*(((1+0.03)^3)-1)+(100/4*(((1+0.03)^2)-1)+(100/4*(((1+0.03)^1)-1))*0.9))))

 

 

  • My formula is in cell I18:

 

 

=(($F$17/$F$15*(((1+$F$18)^4)-1)+($F$17/$F$15*(((1+$F$18)^3)-1)+($F$17/$F$15*(((1+$F$18)^2)-1)+($F$17/$F$15*(((1+$F$18)^1)-1))*0.9))))

 

 

 

And both produces same results.

 

Remember whenever you are using cell references in the formula, Excel makes the formula  dynamic, and change value in cell depends on situation, if and when required or not.

 

Highlighted

@Rajesh-S Allow me to comment: The point is that the number of times the part "(1+%)^n" needs to be included, varies with the number of periods. Therefore you cannot build a static formula that includes a fixed number of these calculations. If there are only two periods, it would be "(1+%)^2 + (1+%)^1". Six periods would be "(1+%)^6 + (1+%)^5 ........ + (1+%)^1".

You'll need a UDF or DA formula as demonstrated above. Try this: change the number of periods to 6 but DO NOT edit your formula! You'll see it won't work.

Highlighted

@HvgoCA 

You could either follow @Riny_van_Eekelen solution of

= (base*factor/n) * SUM((1+perc)^k - 1)
where k is
=SEQUENCE(n)

or you could bite the bullet and sum the geometric series algebraically 

= (base*factor/n) * (((1+perc)^n - 1)*(1+perc)/perc - n)

 

Highlighted

@Riny_van_Eekelen 

 

Check my formula I've never suggested to use Cell references for PERIODs,,, are sitll ^4, ^3, ^2 & ^1,,, I have shown that how the value of r , n & i can be used through Cell references.

 

Since the OP (original post owner) has raised the issue,,, "change the period, it automatically return the value, like this if, n = 2", and I responded that value of n can be stored in cell even,, no where the OP said the period.

 

In example above OP has used

r = 100
n = 4
i = 3%

No description of PERIOD !!

 

  • And if the PERIODs are few, then we may also put then in cells,, like ^$A$1 for ^4 and others.

I'm agree on using UDF, since is better and faster. 

Highlighted

@Rajesh-S Let's agree that we interpret the original post differently.

Highlighted

@Rajesh-S 

My implementation of the algebraic solutions contains @Riny_van_Eekelen 's as a fully functional solution, as well as listing the terms that he summed.  I see no problem with his solution.