diff options
author | Eike Rathke <erack@redhat.com> | 2022-05-06 23:49:13 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-05-07 21:04:23 +0200 |
commit | dad860ac671dd629401ecdf62b804e6e42b176ec (patch) | |
tree | 6140f5f15cc7cecd8609c6892a0243a9dc918db9 | |
parent | 8f99fe30d0661e278824b2f8f65aaa5f94a622ac (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
(cherry picked from commit 4ea44fdb19e568093ab1e0549c3ffa33296a486b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133868
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sc/source/core/tool/interpr6.cxx | 15 |
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 } } |