summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2022-05-06 23:49:13 +0200
committerEike Rathke <erack@redhat.com>2022-05-07 01:30:21 +0200
commit4ea44fdb19e568093ab1e0549c3ffa33296a486b (patch)
tree6c52c2e1645b36471c7ea7e9713c4a8cd51c2f1c /sc
parent18715f6a63af55045b108b98abeffeae8e51518b (diff)
Resolves: tdf#148843 Handle single reference error values correctly
... if errors are to be ignored through AGGREGATE(). Affected were AVERAGE, SUM, SUMSQ and PRODUCT. An error encountered in this constellation lead to the next argument being ignored as well. Change-Id: Ief28d79b4c230b1a2b6f8f0a865fbf8f51854c4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133964 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr6.cxx15
1 files changed, 7 insertions, 8 deletions
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 9dd442624884..0d80a8842566 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -637,8 +637,14 @@ void ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
}
else if (aCell.hasNumeric())
{
- nCount++;
fVal = GetCellValue(aAdr, aCell);
+ if (nGlobalError != FormulaError::NONE)
+ {
+ if (eFunc == ifCOUNT || (mnSubTotalFlags & SubtotalFlags::IgnoreErrVal))
+ nGlobalError = FormulaError::NONE;
+ break;
+ }
+ nCount++;
CurFmtToFuncFmt();
switch( eFunc )
{
@@ -646,13 +652,6 @@ void ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
case ifSUM: fRes += fVal; break;
case ifSUMSQ: fRes += fVal * fVal; break;
case ifPRODUCT: fRes *= fVal; break;
- case ifCOUNT:
- if ( nGlobalError != FormulaError::NONE )
- {
- nGlobalError = FormulaError::NONE;
- nCount--;
- }
- break;
default: ; // nothing
}
}