Letting excel calculate with ^n

Koejns

New Member
Joined
May 24, 2011
Messages
14
I want to calculate the Net present value over a variable time of years.
Now I've got the formula =SUM(FV/(1+interest)^n where n is the amount of years.
However I want the SUM of all years apart.
I can set a expected number of years for the project but this is variable. So for instance I set the expected project years at 20 and I want Excel to automaticly calculate the SUM of (FV/(1+interest)^1+(FV/(1+interest)^2+(FV/(1+interest)^3....etc.+(FV/(1+interest)^20

How can I program this?
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I can't seem to think of a way to calculate this with an excel formula as I'm not really familiar with array formulas.

So, here is a VBA code:
Code:
Public Function calcNetPresent(FV as Double, interest As Double, years As Double) As Double
    For i = 1 To years
        calcNetPresent = calcNetPresent + (FV / (1 + interest) ^ 20)
    Next i
End Function

Put this code in your worksheet module and use it like a formula on your spreadsheet
Code:
=calcNetPresent (FV, interest, years)
 
Upvote 0
Thanks for this answer. The question however, remains because the client I write this excel sheet for has specificly asked me not to write VBAs or macros
 
Upvote 0
If you FV is fixed over all durations and your interest rate does not change, then you can use the following formula to derive you present value:

=-PV(rate,years,FV)

This assumes that the FV occurs at the end of the year. If it is at the beginning of the year, change the formula to

=-PV(rate,years,FV,,1)
 
Upvote 0
Code:
=SUM(FV / (1 + interest) ^ ROW(1:year))

To use an array formula, always enter with Ctrl+Shift+Enter
 
Upvote 0
If you FV is fixed over all durations and your interest rate does not change, then you can use the following formula to derive you present value:

=-PV(rate,years,FV)

This assumes that the FV occurs at the end of the year. If it is at the beginning of the year, change the formula to

=-PV(rate,years,FV,,1)

Hi, Seti. What does "-" infront of the formula do?
 
Upvote 0
Well, the PV formula returns a negative value if the FV value is positive. I assume that the OP does not want that, so I put a minus sign at the beginning. It is optional, depending on the use of the result.
 
Upvote 0
So I tried it and kpark91's formula returns the correct value as the FV formula returns something strange so I'm going to try it with the formula I stated myself and got upgraded by kpark91.

The only thing that still bothers me: If I set the ROW(1:Years) with the years as a reference to a cell the ROW formula doesn't calculate any value, how can I get rid of this problem?
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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