RangeNPV - script function
RangeNPV() returns the net present value of an investment based on a discount rate and a series of future payments (negative values) and incomes (positive values). The result has a default number format of money.
For cash flows that are not necessarily periodic, see RangeXNPV - script function.
RangeNPV(discount_rate, value[,value][, Expression])
Return data type: numeric
- discount_rate: The interest rate per period.
- value: A payment or income occurring at the end of each period. Each value may be a single value or a range of values as returned by an inter-record function with a third optional parameter.
- Expression: Optional expressions or fields containing the range of data to be measured.
Text values, NULL values and missing values are disregarded.
RangeNPV(0.1,-10000,3000,4200,6800) returns 1188.44.
Add the example script to your document and run it. Then add, at least, the fields listed in the results column to a sheet in your document to see the result.
recno() as RangeID,
RangeNPV(Field1,Field2,Field3) as RangeNPV;
LOAD * INLINE [
] (delimiter is '|');
The resulting table shows the returned values of RangeNPV for each of the records in the table: