You are here

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

* STDEVP * * Calculates standard deviation based on the entire population * * Excel Function: * STDEVP(value1[,value2[, ...]]) * * @access public * @category Statistical Functions *

Parameters

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

2 calls to PHPExcel_Calculation_Statistical::STDEVP()
PHPExcel_Calculation_Database::DSTDEVP in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Database.php
* DSTDEVP * * Calculates the standard deviation of a population based on the entire population by using the * numbers in a column of a list or database that match conditions that you specify. * * Excel Function: …
PHPExcel_Calculation_MathTrig::SUBTOTAL in vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php
* SUBTOTAL * * Returns a subtotal in a list or database. * *

File

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

Class

PHPExcel_Calculation_Statistical
PHPExcel_Calculation_Statistical

Code

public static function STDEVP() {
  $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());

  // Return value
  $returnValue = null;
  $aMean = self::AVERAGE($aArgs);
  if (!is_null($aMean)) {
    $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 = pow($arg - $aMean, 2);
        }
        else {
          $returnValue += pow($arg - $aMean, 2);
        }
        ++$aCount;
      }
    }

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