You are here

public static function PHPExcel_Calculation_Statistical::QUARTILE in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php \PHPExcel_Calculation_Statistical::QUARTILE()

* QUARTILE * * Returns the quartile of a data set. * * Excel Function: * QUARTILE(value1[,value2[, ...]],entry) * * @access public * @category Statistical Functions *

Parameters

mixed $arg,... Data values: * @param int $entry Quartile value in the range 1..3, inclusive. * @return float

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php, line 2773

Class

PHPExcel_Calculation_Statistical
PHPExcel_Calculation_Statistical

Code

public static function QUARTILE() {
  $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());

  // Calculate
  $entry = floor(array_pop($aArgs));
  if (is_numeric($entry) && !is_string($entry)) {
    $entry /= 4;
    if ($entry < 0 || $entry > 1) {
      return PHPExcel_Calculation_Functions::NaN();
    }
    return self::PERCENTILE($aArgs, $entry);
  }
  return PHPExcel_Calculation_Functions::VALUE();
}