public static function PHPExcel_Calculation_Financial::NPV in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Financial.php \PHPExcel_Calculation_Financial::NPV()
* NPV * * Returns the Net Present Value of a cash flow series given a discount rate. * *
Return value
float
1 call to PHPExcel_Calculation_Financial::NPV()
- PHPExcel_Calculation_Financial::IRR in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Financial.php - * IRR * * Returns the internal rate of return for a series of cash flows represented by the numbers in values. * These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur * at regular…
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Financial.php, line 1533
Class
- PHPExcel_Calculation_Financial
- PHPExcel_Calculation_Financial
Code
public static function NPV() {
// Return value
$returnValue = 0;
// Loop through arguments
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
// Calculate
$rate = array_shift($aArgs);
for ($i = 1; $i <= count($aArgs); ++$i) {
// Is it a numeric value?
if (is_numeric($aArgs[$i - 1])) {
$returnValue += $aArgs[$i - 1] / pow(1 + $rate, $i);
}
}
// Return
return $returnValue;
}