Kosior_1990
New Member
- Joined
- Aug 6, 2011
- Messages
- 3
Hello!
I would like to create correct NPV function in excel (because the one built-in excel do not include cash-flow form period 0).Below I list my objects:
1.Count NPV
2.User selects range (rows are adjacent, each below other in one column)
3.Users inputs interest rate as a number (not percentage, in order to speed up calculation)
4.First row from selection is divided by 0, next one is divided by (1+i)^k (k - number of row in selection); i - it is interest rate
I have written the code, but it doesn't work. Could you help me please?
Function MNPV(interest_rate As Double, flow())
Dim i As Integer
MNPV = 0
For i = 0 To UBound(flow)
flow(i) = flow(i) / ((1 + interest_rate / 100) ^ i)
MNPV = MNPV + flow(i)
Next i
End Function
Thank you very much for all responses!
I would like to create correct NPV function in excel (because the one built-in excel do not include cash-flow form period 0).Below I list my objects:
1.Count NPV
2.User selects range (rows are adjacent, each below other in one column)
3.Users inputs interest rate as a number (not percentage, in order to speed up calculation)
4.First row from selection is divided by 0, next one is divided by (1+i)^k (k - number of row in selection); i - it is interest rate
I have written the code, but it doesn't work. Could you help me please?
Function MNPV(interest_rate As Double, flow())
Dim i As Integer
MNPV = 0
For i = 0 To UBound(flow)
flow(i) = flow(i) / ((1 + interest_rate / 100) ^ i)
MNPV = MNPV + flow(i)
Next i
End Function
Thank you very much for all responses!