diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 621e3d9ee8a0..b8ece94894b4 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -5740,7 +5740,8 @@ void ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc ) ScMatrixRef pResultMatrix = QueryMat( pQueryMatrix, aOptions); if (nGlobalError != FormulaError::NONE || !pResultMatrix) { - SetError( FormulaError::IllegalParameter); + PushIllegalParameter(); + return; } if (pSumExtraMatrix) @@ -5764,6 +5765,25 @@ void ScInterpreter::IterateParametersIf( ScIterFuncIf eFunc ) } } } + else if (!bSumExtraRange) + { + for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol) + { + for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow) + { + if (pResultMatrix->IsValue( nCol, nRow) && + pResultMatrix->GetDouble( nCol, nRow)) + { + if (pQueryMatrix->IsValue( nCol, nRow)) + { + fVal = pQueryMatrix->GetDouble( nCol, nRow); + ++fCount; + fSum += fVal; + } + } + } + } + } else { for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)