public static function PHPExcel_Calculation_Statistical::AVEDEV in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php \PHPExcel_Calculation_Statistical::AVEDEV()
* AVEDEV * * Returns the average of the absolute deviations of data points from their mean. * AVEDEV is a measure of the variability in a data set. * * Excel Function: * AVEDEV(value1[,value2[, ...]]) * * @access public * @category Statistical Functions *
Parameters
mixed $arg,... Data values: * @return float
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Statistical.php, line 700
Class
- PHPExcel_Calculation_Statistical
- PHPExcel_Calculation_Statistical
Code
public static function AVEDEV() {
$aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
// Return value
$returnValue = null;
$aMean = self::AVERAGE($aArgs);
if ($aMean != PHPExcel_Calculation_Functions::DIV0()) {
$aCount = 0;
foreach ($aArgs as $k => $arg) {
if (is_bool($arg) && (!PHPExcel_Calculation_Functions::isCellValue($k) || PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE)) {
$arg = (int) $arg;
}
// Is it a numeric value?
if (is_numeric($arg) && !is_string($arg)) {
if (is_null($returnValue)) {
$returnValue = abs($arg - $aMean);
}
else {
$returnValue += abs($arg - $aMean);
}
++$aCount;
}
}
// Return
if ($aCount == 0) {
return PHPExcel_Calculation_Functions::DIV0();
}
return $returnValue / $aCount;
}
return PHPExcel_Calculation_Functions::NaN();
}