code: public function getCalculatedValue($resetLog = true)
      {
          if ($this->dataType == DataType::TYPE_FORMULA) {
              try {
                  $result = Calculation::getInstance(
                      $this->getWorksheet()->getParent()
                  )->calculateCellValue($this, $resetLog);
                  //    We don't yet handle array returns
                  if (is_array($result)) {
                      while (is_array($result)) {
                          $result = array_pop($result);
                      }
                  }
              } catch (Exception $ex) {
                  if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->calculatedValue !== null)) {
                      return $this->calculatedValue; // Fallback for calculations referencing external files.
                  }
  
                  throw new \PhpOffice\PhpSpreadsheet\Calculation\Exception(
                      $this->getWorksheet()->getTitle() . '!' . $this->getCoordinate() . ' -> ' . $ex->getMessage()
                  );
              }
  
              if ($result === '#Not Yet Implemented') {
                  return $this->calculatedValue; // Fallback if calculation engine does not support the formula.
              }
  
              return $result;
          } elseif ($this->value instanceof RichText) {
              return $this->value->getPlainText();
          }
  
          return $this->value;
      }
docs: Get calculated cell value.
  
  @param bool $resetLog Whether the calculation engine logger should be reset or not
  
  @throws Exception
  
  @return mixed