You are here

public static function PHPExcel_Calculation_MathTrig::SUBTOTAL in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php \PHPExcel_Calculation_MathTrig::SUBTOTAL()

* SUBTOTAL * * Returns a subtotal in a list or database. * *

Parameters

int the number 1 to 11 that specifies which function to: * use in calculating subtotals within a list. * @param array of mixed Data Series * @return float

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php, line 1067

Class

PHPExcel_Calculation_MathTrig
PHPExcel_Calculation_MathTrig

Code

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

  // Calculate
  $subtotal = array_shift($aArgs);
  if (is_numeric($subtotal) && !is_string($subtotal)) {
    switch ($subtotal) {
      case 1:
        return PHPExcel_Calculation_Statistical::AVERAGE($aArgs);
        break;
      case 2:
        return PHPExcel_Calculation_Statistical::COUNT($aArgs);
        break;
      case 3:
        return PHPExcel_Calculation_Statistical::COUNTA($aArgs);
        break;
      case 4:
        return PHPExcel_Calculation_Statistical::MAX($aArgs);
        break;
      case 5:
        return PHPExcel_Calculation_Statistical::MIN($aArgs);
        break;
      case 6:
        return self::PRODUCT($aArgs);
        break;
      case 7:
        return PHPExcel_Calculation_Statistical::STDEV($aArgs);
        break;
      case 8:
        return PHPExcel_Calculation_Statistical::STDEVP($aArgs);
        break;
      case 9:
        return self::SUM($aArgs);
        break;
      case 10:
        return PHPExcel_Calculation_Statistical::VARFunc($aArgs);
        break;
      case 11:
        return PHPExcel_Calculation_Statistical::VARP($aArgs);
        break;
    }
  }
  return PHPExcel_Calculation_Functions::VALUE();
}