You are here

public static function PHPExcel_Calculation_Statistical::MODE in Loft Data Grids 6.2

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

* MODE * * Returns the most frequently occurring, or repetitive, value in an array or range of data * * Excel Function: * MODE(value1[,value2[, ...]]) * * @access public * @category Statistical Functions *

Parameters

mixed $arg,... Data values: * @return float

File

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

Class

PHPExcel_Calculation_Statistical
PHPExcel_Calculation_Statistical

Code

public static function MODE() {

  // Return value
  $returnValue = PHPExcel_Calculation_Functions::NA();

  // Loop through arguments
  $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
  $mArgs = array();
  foreach ($aArgs as $arg) {

    // Is it a numeric value?
    if (is_numeric($arg) && !is_string($arg)) {
      $mArgs[] = $arg;
    }
  }
  if (!empty($mArgs)) {
    return self::_modeCalc($mArgs);
  }

  // Return
  return $returnValue;
}