diff --git a/Classes/PHPExcel/Calculation/LookupRef.php b/Classes/PHPExcel/Calculation/LookupRef.php index 7ebca4d9..bcf755fa 100644 --- a/Classes/PHPExcel/Calculation/LookupRef.php +++ b/Classes/PHPExcel/Calculation/LookupRef.php @@ -283,7 +283,19 @@ class PHPExcel_Calculation_LookupRef { if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) || ((!is_null($cellAddress2)) && (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) { - return PHPExcel_Calculation_Functions::REF(); + + if (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) { + return PHPExcel_Calculation_Functions::REF(); + } + + if (strpos($cellAddress,'!') !== false) { + list($sheetName,$cellAddress) = explode('!',$cellAddress); + $pSheet = $pCell->getParent()->getParent()->getSheetByName($sheetName); + } else { + $pSheet = $pCell->getParent(); + } + + return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, False); } if (strpos($cellAddress,'!') !== false) { diff --git a/changelog.txt b/changelog.txt index 492d9abc..75185b78 100644 --- a/changelog.txt +++ b/changelog.txt @@ -32,6 +32,7 @@ Fixed in SVN: - 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 - Bugfix: (gilles06) Work item 15707 - ini_set() call in Calculation class destructor - Bugfix: (MBaker) Work item 15786 - RangeToArray strange array keys +- Bugfix: (MBaker) Work item 15762 - INDIRECT() function doesn't work with named ranges - 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