diff --git a/Classes/PHPExcel/Calculation.php b/Classes/PHPExcel/Calculation.php index e4120272..71ed083e 100644 --- a/Classes/PHPExcel/Calculation.php +++ b/Classes/PHPExcel/Calculation.php @@ -3001,14 +3001,31 @@ class PHPExcel_Calculation { // We must have two operands, error if we don't if (is_null($operand2Data = $stack->pop())) return $this->_raiseFormulaError('Internal error - Operand value missing from stack'); if (is_null($operand1Data = $stack->pop())) return $this->_raiseFormulaError('Internal error - Operand value missing from stack'); - // Log what we're doing + $operand1 = $operand1Data['value']; + if ((is_null($operand1Data['reference'])) && (is_array($operand1))) { + $rowKey = array_shift(array_keys($operand1)); + $colKey = array_shift(array_keys($operand1[$rowKey])); + if (ctype_upper($colKey)) { + $operand1Data['reference'] = $colKey.$rowKey; + } + } $operand2 = $operand2Data['value']; + if ((is_null($operand2Data['reference'])) && (is_array($operand2))) { + $rowKey = array_shift(array_keys($operand2)); + $colKey = array_shift(array_keys($operand2[$rowKey])); + if (ctype_upper($colKey)) { + $operand2Data['reference'] = $colKey.$rowKey; + } + } + + // Log what we're doing if ($token == ':') { $this->_writeDebug('Evaluating Range '.$this->_showValue($operand1Data['reference']).$token.$this->_showValue($operand2Data['reference'])); } else { $this->_writeDebug('Evaluating '.$this->_showValue($operand1).' '.$token.' '.$this->_showValue($operand2)); } + // Process the operation in the appropriate manner switch ($token) { // Comparison (Boolean) Operators diff --git a/changelog.txt b/changelog.txt index 98ea4093..a4c89c32 100644 --- a/changelog.txt +++ b/changelog.txt @@ -27,6 +27,7 @@ Fixed in SVN: - Bugfix: (MBaker) Work item 15459 - Invalid cell coordinate in Autofilter for Excel2007 Writer - Bugfix: (MBaker) Work item 15518 - PCLZip library issue - Bugfix: (MBaker) Work item 15537 - Excel2007 Reader canRead function bug +- Bugfix: (MBaker) Support for Excel functions whose return can be used as either a value or as a cell reference depending on its context within a formula - General: (MBaker) Work item 15405 - Two easy to fix Issues concerning PHPExcel_Token_Stack (l10n/UC) - General: (MBaker) Work item 15461 - Locale file paths not fit for windows