You are here

public static function PHPExcel_Calculation_Statistical::AVERAGEA 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::AVERAGEA()

* AVERAGEA * * Returns the average of its arguments, including numbers, text, and logical values * * Excel Function: * AVERAGEA(value1[,value2[, ...]]) * * @access public * @category Statistical Functions *

Parameters

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

2 calls to PHPExcel_Calculation_Statistical::AVERAGEA()
PHPExcel_Calculation_Statistical::STDEVA in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php
* STDEVA * * Estimates standard deviation based on a sample, including numbers, text, and logical values * * Excel Function: * STDEVA(value1[,value2[, ...]]) * * @access public * @category Statistical Functions *
PHPExcel_Calculation_Statistical::STDEVPA in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php
* STDEVPA * * Calculates standard deviation based on the entire population, including numbers, text, and logical values * * Excel Function: * STDEVPA(value1[,value2[, ...]]) * * @access public * @category Statistical Functions *

File

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

Class

PHPExcel_Calculation_Statistical
PHPExcel_Calculation_Statistical

Code

public static function AVERAGEA() {

  // Return value
  $returnValue = null;
  $aCount = 0;

  // Loop through arguments
  foreach (PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args()) as $k => $arg) {
    if (is_bool($arg) && !PHPExcel_Calculation_Functions::isMatrixValue($k)) {
    }
    else {
      if (is_numeric($arg) || is_bool($arg) || is_string($arg) && $arg != '') {
        if (is_bool($arg)) {
          $arg = (int) $arg;
        }
        elseif (is_string($arg)) {
          $arg = 0;
        }
        if (is_null($returnValue)) {
          $returnValue = $arg;
        }
        else {
          $returnValue += $arg;
        }
        ++$aCount;
      }
    }
  }

  // Return
  if ($aCount > 0) {
    return $returnValue / $aCount;
  }
  else {
    return PHPExcel_Calculation_Functions::DIV0();
  }
}