Funci贸 NPV [VBA]

Calculates the Net Present Value of an investment, based on a supplied discount rate, and a series of deposits and withdrawals.

warning

Aquesta constant, funci贸 o objecte s'activa mitjan莽ant l'expressi贸 Option VBASupport 1, col路locada abans del codi executable del programa en un m貌dul.


Sintaxi:


NPV (Rate as Double, Values() as Double)

Valor de retorn:

Double

Par脿metres:

Taxa 茅s la taxa de descompte d'un per铆ode.

Valors() 茅s una matriu que representa dip貌sits (valors positius) o retirades (valors negatius).

Codis d'error

5 La crida al procediment no 茅s v脿lida

Exemple:


REM ***** BASIC *****
Option VBASupport 1
Sub ExampleNPV
 Dim r As Double
 Dim pValues(5) as Double
 pValues(0) = 100
 pValues(1) = 100
 pValues(2) = 100
 pValues(3) = -300
 pValues(4) = 100
 pValues(5) = 100
 r = 0.06
 p = NPV( r, pValues)
 Print p ' retorna 174,894967305331
End Sub

Ens cal la vostra ajuda!