# NetPresentValue ( )

Function stats

Average user rating
5.0000
Support
FileMaker 7.0 +
Date posted
30 January 2009
Last updated
30 January 2009
Version
Recursive function
Yes

Author Info
comment

3 functions

Average Rating 4.8 Function overview

Prototype

NetPresentValue  ( listOfPayments;   interestRate )

Parameters

listOfPayments  a return-separated list of unequal payment amounts

interestRate  the interest rate per interval

Description

Tags:  Financial

Returns the net present value (NPV) of a series of unequal future payments (negative values) and income (positive values) occuring at regular intervals, assuming a fixed interestRate per interval.

Same as Filemaker's native NPV() function - but payments do not need to be listed in a repeating field.

Use this function to calculate NPV. For example, if you invest a sum of money and get paid back unequal amounts over a period of several years, you can use the NetPresentValue function to calculate the net present value of your investment.

Examples
NetPresentValue ( List ( -2000 ; 600; 300; 500; 700; 400 ) ; 0.5 ) returns 156.9127744508813684

NetPresentValue ( List ( Payments::Amount ) ; 0.1 ) returns 16758.3560487050685808 when the related records in the Payments table contain the amounts of -5000 (the initial investment), 10,000, 0, 10,000, and 10,000.

NOTE:
The data for these examples comes from Filemaker's help on the NPV() function - in order to demonstrate that the custom function returns the same results as the native one.

However, in the original text the negative amounts -2000 and -5000 are called "the initial payment" or "the initial investment". Unfortunately, this is quite incorrect: the first amount in the series is presumed to be paid AT THE END of the first period, not at the beginning of the entire transaction, as one would expect.

To calculate the correct NPV in a situation where the series of payments is preceded by an initial income (or vice versa), calculate the NPV of future payments only and subtract the initial income from the result, e.g.:

NetPresentValue ( List ( 600; 300; 500; 700; 400 ) ; 0.5 ) - 2000

returns 164.7584131734254368.

Examples

Sample input

NetPresentValue ( List ( -2000 ; 600; 300; 500; 700; 400 ) ; 0.5 )

Sample output

156.9127744508813684

Function code

/*
NetPresentValue function

Author
*COMMENT Visual Realisation

Format
NetPresentValue ( listOfPayments ; interestRate )

Parameters
listOfPayments - a return-separated list of unequal payment amounts

interestRate - the interest rate per interval

Data type returned
number

Description
Returns the net present value (NPV) of a series of unequal future payments (negative values) and income (positive values) occuring at regular intervals, assuming a fixed interestRate per interval.

Same as Filemaker's native NPV() function - but payments do not need to be listed in a repeating field.

Use this function to calculate NPV. For example, if you invest a sum of money and get paid back unequal amounts over a period of several years, you can use the NetPresentValue function to calculate the net present value of your investment.

Examples
NetPresentValue ( List ( -2000 ; 600; 300; 500; 700; 400 ) ; 0.5 ) returns 156.9127744508813684

NetPresentValue ( List ( Payments::Amount ) ; 0.1 ) returns 16758.3560487050685808 when the related records in the Payments table contain the amounts of -5000 (the initial investment), 10,000, 0, 10,000, and 10,000.

NOTE:
The data for these examples comes from Filemaker's help on the NPV() function - in order to demonstrate that the custom function returns the same results as the native one.

However, in the original text the negative amounts -2000 and -5000 are called "the initial payment" or "the initial investment". Unfortunately, this is quite incorrect: the first amount in the series is presumed to be paid AT THE END of the first period, not at the beginning of the entire transaction, as one would expect.

To calculate the correct NPV in a situation where the series of payments is preceded by an initial income (or vice versa), calculate the NPV of future payments only and subtract the initial income from the result, e.g.:

NetPresentValue ( List ( 600; 300; 500; 700; 400 ) ; 0.5 ) - 2000

returns 164.7584131734254368.
*/

Let ( [
countPayments = ValueCount ( listOfPayments ) ;
payment = GetValue ( listOfPayments ; countPayments )
] ;
payment / ( 1 + interestRate )^countPayments
+
Case (
countPayments > 1 ;
NetPresentValue ( LeftValues ( listOfPayments ; countPayments - 1 ) ; interestRate )
)
)

// ===================================
/*

This function is published on FileMaker Custom Functions
to check for updates and provide feedback and bug reports

Prototype: NetPresentValue( listOfPayments; interestRate )
Function Author: comment (http://www.fmfunctions.com/mid/108)
Last updated: 30 January 2009
Version: 1.1

*/
// ===================================

# Top Tags

Text Parsing  (33)
List  (32)
Date  (28)
XML  (27)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (13)
Filter  (12)
Layout Objects  (11)
Design  (10)
Array  (8)