public static function PHPExcel_Calculation_Statistical::PERCENTILE in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php \PHPExcel_Calculation_Statistical::PERCENTILE()
* PERCENTILE * * Returns the nth percentile of values in a range.. * * Excel Function: * PERCENTILE(value1[,value2[, ...]],entry) * * @access public * @category Statistical Functions *
Parameters
mixed $arg,... Data values: * @param float $entry Percentile value in the range 0..1, inclusive. * @return float
1 call to PHPExcel_Calculation_Statistical::PERCENTILE()
- PHPExcel_Calculation_Statistical::QUARTILE in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Statistical.php - * QUARTILE * * Returns the quartile of a data set. * * Excel Function: * QUARTILE(value1[,value2[, ...]],entry) * * @access public * @category Statistical Functions *
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Calculation/ Statistical.php, line 2612
Class
- PHPExcel_Calculation_Statistical
- PHPExcel_Calculation_Statistical
Code
public static function PERCENTILE() {
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
// Calculate
$entry = array_pop($aArgs);
if (is_numeric($entry) && !is_string($entry)) {
if ($entry < 0 || $entry > 1) {
return PHPExcel_Calculation_Functions::NaN();
}
$mArgs = array();
foreach ($aArgs as $arg) {
// Is it a numeric value?
if (is_numeric($arg) && !is_string($arg)) {
$mArgs[] = $arg;
}
}
$mValueCount = count($mArgs);
if ($mValueCount > 0) {
sort($mArgs);
$count = self::COUNT($mArgs);
$index = $entry * ($count - 1);
$iBase = floor($index);
if ($index == $iBase) {
return $mArgs[$index];
}
else {
$iNext = $iBase + 1;
$iProportion = $index - $iBase;
return $mArgs[$iBase] + ($mArgs[$iNext] - $mArgs[$iBase]) * $iProportion;
}
}
}
return PHPExcel_Calculation_Functions::VALUE();
}