views:

245

answers:

1

Hi All

i want to calculate the NPV ( Net Present Value ) using PHP.

Below is the detail which i have.

    discount rate : 15%

    Cash Flow Values per Year:

    Year 1: 110000
    Year 2: 122000 
    Year 3: 135200
    Year 4: 149720
    Year 5: 157706
    Year 6: 166091

NPV Formula which i am using.

NPV = sum of all years( (Ci)/(1+r)^i)

i=1,2,3,4,5,...
Ci= Cash Flow for year i
r=rate of discount

Any help.

Thanks In advance

Avinash

+1  A: 

You would calculate the NPV of each year using the following formula: (value) / ((1 + 0.15) ^ (year)) then sum all the results to get your final NPV - where ^ means to the power of.

So for year two it would be: 122000 / ((1.15)^ 2).

At the current point in time the power ^ value would be 0

saret
Yes that i am doing, but not getting the right answer.My answer is 416971.03..
Avinash
Can you edit your original post to include the code - seems like there is an issue in the algorithm - what value do you calculate for the year 1 entry? - It is also possible that some rounding issue might be occuring in the calculation
saret
i have not created any code for this yet, i am just testing it on paper for now.I am taking 0 as a first year value. will it be a problem?
Avinash
0 means the current point in time - not a year from now, so $1 received now would be worth $1 at this point in time, there is no change in what that $1 would be worth if received now
saret
i am not getting that what are u trying to say,Can you please become some more descriptive??
Avinash
Sorry by 0 do you mean the value used as the power or do you mean the amount received at that point in time (the numerator in equation)? - the previous comment assumed you were talking about the power of value
saret
Can you post the equation you are using (even if on paper) - will be easier to detect what is going wrong with your result then
saret
hi, i have added the formula which i am using to the question....
Avinash
Sorry for late reply, been away.So was your final formula this?:=(110000/(1.15)^1) + (122000/(1.15)^2) + (135200/(1.15)^3) + (149720/(1.15)^4) + (157706/(1.15)^5) + (166091/(1.15)^6)You can pop this equation into excel (or some expression evaluator) to see what the result should be
saret