WorksheetFunction.Xnpv Method
Returns the net present value for a schedule of cash flows that is not necessarily periodic.
Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)
Syntax
'Declaration
Function Xnpv ( _
Arg1 As Object, _
Arg2 As Object _
) As Double
'Usage
Dim instance As WorksheetFunction
Dim Arg1 As Object
Dim Arg2 As Object
Dim returnValue As Double
returnValue = instance.Xnpv(Arg1, Arg2)
double Xnpv(
Object Arg1,
Object Arg2
)
Parameters
Arg1
Type: System.ObjectA series of cash flows that corresponds to a schedule of payments in dates. The first payment is optional and corresponds to a cost or payment that occurs at the beginning of the investment.
Arg2
Type: System.ObjectA schedule of payment dates that corresponds to the cash flow payments. The first payment date indicates the beginning of the schedule of payments. All other dates must be later than this date, but they may occur in any order.
Return Value
Type: System.Double
Remarks
Important
The Xnpv method does not provide a parameter that corresponds to the rate argument required by the corresponding XNPV function (=XNPV(rate, values, dates)). To work around this limitation in VBA code, instead of using the Xpnv method, call the XNPV function by using the Evaluate(Object) method.
To calculate the net present value for a series of cash flows that is periodic, use the Npv(Double, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object) method.