fix: preserve zero results from AVERAGEIF - #1733
Open
Tobiadefami wants to merge 2 commits into
Open
Conversation
|
@Tobiadefami thanks for the pull request. No CLA step needed here — our records show you signed the Contributor License Agreement on 2026-07-31. That signature came from our previous signing form and has been carried over, so there is nothing for you to re-sign. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
hyperformula-docs | 8775411 | Commit Preview URL Branch Preview URL |
Aug 13 2026, 10:00 AM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1733 +/- ##
========================================
Coverage 97.31% 97.31%
========================================
Files 195 195
Lines 15719 15719
Branches 3455 3455
========================================
Hits 15297 15297
Misses 414 414
Partials 8 8
🚀 New features to boost your workflow:
|
Performance comparison of head (8775411) vs base (61ead73) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
AVERAGEIFreturned a#DIV/0!error when matching values produced a valid average of0.This happened because the result used a logical OR fallback, which treated
0as if no average had beencalculated. This change uses nullish coalescing so that only an absent result produces
#DIV/0!, while avalid zero is returned normally.
How did you test your changes?
Added a regression test where the matching values are
-1and1, producing an average of0.The test was verified to fail with
#DIV/0!before the fix and pass with0after the fix.I also ran:
AVERAGEIFtest suite: all 14 tests passed.npm run bundle:cjs: TypeScript and the CommonJS build completed successfully.Types of changes
expected anymore)
Related issues:
None.
Checklist:
hyperformula.handsontable.com/guide/contributing.html) and I confirm that my code follows the code style of
this project.
os/part4-formula/OpenDocument-v1.3-os-part4-formula.html) standard.
CHANGELOG.md) file.
Note
Low Risk
Single-expression change in AVERAGEIF error handling with no auth, data, or API surface impact.
Overview
AVERAGEIF incorrectly returned
#DIV/0!when the matched cells produced a true average of 0 (e.g. values-1and1).The return path in
ConditionalAggregationPluginswitched from logical OR (||) to nullish coalescing (??) when falling back to#DIV/0!. A computed 0 is no longer treated as “no result”; only a missing average (no matching count) still yields the division-by-zero error.The unreleased CHANGELOG entry documents this fix.
Reviewed by Cursor Bugbot for commit 8775411. Bugbot is set up for automated code reviews on this repo. Configure here.