diff --git a/CHANGELOG.md b/CHANGELOG.md index 24ecffc1c..4ccec0bbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Fixed + +- Fixed the `AVERAGEIF` function returning a division-by-zero error when the calculated average was `0`. [#1733](https://github.com/handsontable/hyperformula/pull/1733) + ## [3.4.0] - 2026-08-10 ### Added diff --git a/src/interpreter/plugin/ConditionalAggregationPlugin.ts b/src/interpreter/plugin/ConditionalAggregationPlugin.ts index f2e74e83c..34e0fc7db 100644 --- a/src/interpreter/plugin/ConditionalAggregationPlugin.ts +++ b/src/interpreter/plugin/ConditionalAggregationPlugin.ts @@ -200,7 +200,7 @@ export class ConditionalAggregationPlugin extends FunctionPlugin implements Func if (averageResult instanceof CellError) { return averageResult } else { - return averageResult.averageValue() || new CellError(ErrorType.DIV_BY_ZERO) + return averageResult.averageValue() ?? new CellError(ErrorType.DIV_BY_ZERO) } }