code: public static function AVERAGE(...$args)
      {
          $returnValue = $aCount = 0;
  
          // Loop through arguments
          foreach (Functions::flattenArrayIndexed($args) as $k => $arg) {
              if ((is_bool($arg)) &&
                  ((!Functions::isCellValue($k)) || (Functions::getCompatibilityMode() == Functions::COMPATIBILITY_OPENOFFICE))) {
                  $arg = (int) $arg;
              }
              // Is it a numeric value?
              if ((is_numeric($arg)) && (!is_string($arg))) {
                  if ($returnValue === null) {
                      $returnValue = $arg;
                  } else {
                      $returnValue += $arg;
                  }
                  ++$aCount;
              }
          }
  
          // Return
          if ($aCount > 0) {
              return $returnValue / $aCount;
          }
  
          return Functions::DIV0();
      }
docs: AVERAGE.
  
  Returns the average (arithmetic mean) of the arguments
  
  Excel Function:
  AVERAGE(value1[,value2[, ...]])
  
  @category Statistical Functions
  
  @param mixed ...$args Data values
  
  @return float