Vesper
Vesper

Reputation: 845

Is there a difference between numpy NPV and excel NPV?

I have excel in which there is a row with 11 values in it.

TotalSavings = [0, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000, 8000]

with the discount rate of 0.08, I calculated the NPV in excel using =NPV(0.08, TotalSavings) (obviously there were 11 columns so instead of TotalSavings there is C3:C14(here C3 is 0 value and C14 is 8000)). Its was 49704. And when I did the same thing with numpy NPV.

print(np.npv(0.08, TotalSavings))

Result was: 53680. Can someone please help? I want the same result as we are getting in excel.

Upvotes: 2

Views: 1034

Answers (1)

wwii
wwii

Reputation: 23763

Seems one uses beginning of period payments and the other uses end of period payments.

numpy's formula is

(values / (1+rate)**np.arange(0, len(values))).sum(axis=0)

Changing it to

(values / (1+rate)**np.arange(1, len(values)+1)).sum(axis=0)

produces the same value you get with excel.



For excel this makes the denominator larger for each term in the summation resulting in a smaller sum.

Upvotes: 5

Related Questions