i+i^1+i^2+.....+i^n

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
will this work?
Code:
Function To_the_Power(ByVal Intger As Long, ByVal Ending_At As Long)
    For i = 1 To Ending_At
        To_the_Power = To_the_Power + (Intger ^ i)
    Next i
End Function
the first number is your base integer, and the second is how many iterations you want to do.
 
Upvote 0
Trying to find out the nominal sum of a cash flow that grows by x% every year for a set number of years . so say i have 10 and it grows 10% a year for 2 years, it would be 10*(1.1^0+1.1^1+1.1^2)=33.1. i need to do this for much more complicated numbers. There is a equation for it but cannot remember right now and dont have enough time to figure it out. :) Thanks again.
 
Upvote 0
if you need to do this with decimals, you need to use DOUBLE instead of long. and why "^0"? that just gives you 1. everytime.

here is your modified code
Code:
Function To_the_Power(ByVal Intger As Double, ByVal Ending_At As Long)
    For i = 0 To Ending_At
        To_the_Power = To_the_Power + (Intger ^ i)
    Next i
End Function
 
Upvote 0
Trying to find out the nominal sum of a cash flow that grows by x% every year for a set number of years . so say i have 10 and it grows 10% a year for 2 years, it would be 10*(1.1^0+1.1^1+1.1^2)=33.1. i need to do this for much more complicated numbers. There is a equation for it but cannot remember right now and dont have enough time to figure it out. :) Thanks again.

Hi

This means than in your first post you forgot the ^0 in the first operand and you want to know the value of

i^0+i^1+i^2+i^3...+i^n

The result is

(i^(n+1)-1)/(i-1)

That you can easily calculate with a formula

In your example, with the initial capital of 10, growing at a 10% rate for 2 years, you get

10*(1.1^0+1.1^1+1.1^2)

applying the formula, is equal to

10*(1.1^3-1)/(1.1-1)=10*(1.331-1)/0.1=10*0.331/.1=33.1
 
Upvote 0
anything to the power of 0, is 1.


... and 0 to the power of anything is? ;)


Anyway, the i^0 which, as you say will be 1 for any growth rate, represents the initial capital. So the expression is equivalent to

1+i^1+i^2+i^3...+i^n

which is equal to, as I wrote:

(i^(n+1)-1)/(i-1)

that you can easily calculate with a formula
 
Upvote 0

Forum statistics

Threads
1,224,584
Messages
6,179,687
Members
452,938
Latest member
babeneker

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