Feature/averageifs function - #1732
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 | 8f54b3a | Commit Preview URL Branch Preview URL |
Aug 13 2026, 09:12 AM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1732 +/- ##
========================================
Coverage 97.31% 97.31%
========================================
Files 195 195
Lines 15719 15742 +23
Branches 3455 3393 -62
========================================
+ Hits 15297 15320 +23
- Misses 414 422 +8
+ Partials 8 0 -8
🚀 New features to boost your workflow:
|
Performance comparison of head (8f54b3a) vs base (61ead73) |
| AverageResult.empty, | ||
| composeFunction, | ||
| (arg) => { | ||
| if (arg instanceof CellError) { |
There was a problem hiding this comment.
Nothing to change here — this is exactly right, and it is actually stricter than its own sibling. averageif's mapFunction a few lines up (around line 206) has no CellError check at all, so an error cell in the averaged range gets silently treated as blank there, while this new averageifs correctly propagates it. Same story as the zero-average fix in #1733 — nice consistency instinct there.
Not asking for a change in this PR — averageif's behavior predates this change and isn't something #1732 broke. But since #1733 is already touching this exact file for the zero-average fix, it might be a cheap one to fold in there too, if you're up for it. Totally optional either way.
Why it matters: a user migrating a single-criterion AVERAGEIF formula to AVERAGEIFS would suddenly start seeing errors that were silently hidden before — confusing, but not something this PR introduced or is responsible for fixing.
|
Hey @Tobiadefami — one process thing unrelated to the code itself (which looks solid, see the review above): the paired Could you open a PR there for this branch? Same thing seems to have happened for #1733's companion branch ( Nothing else blocking here — just flagging it now so it's not a surprise closer to merge. |
Context
HyperFormula supports
AVERAGEIFand other conditional aggregation functions, but it does not supportAVERAGEIFS.This change adds
AVERAGEIFS, allowing values to be averaged when all corresponding criteria are satisfied. It uses the existing conditional aggregation and caching infrastructure and includes function metadata, translations, documentation, and tests.How did you test your changes?
Added tests covering:
All 28 focused tests passed.
Additionally, I ran:
npm run bundle:cjsnpm run docs:generate-function-docsBoth commands completed successfully.
Types of changes
expected anymore)
Related issues:
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
Additive spreadsheet function using established SUMIFS/AVERAGEIF patterns; no changes to auth, persistence, or core engine behavior.
Overview
Adds AVERAGEIFS, averaging numeric cells in a range when all paired criterion ranges and criteria match—aligned with Excel/Google Sheets and the existing
SUMIFS/AVERAGEIFpattern.Implementation wires
averageifsinConditionalAggregationPluginthroughcomputeConditionalAggregationFunctionwithAverageResultcomposition,repeatLastArgs: 2for extra range/criterion pairs, and#DIV/0!when no qualifying numeric values exist.Also updates the changelog, statistical function metadata, and localized function names across language packs.
Reviewed by Cursor Bugbot for commit 8f54b3a. Bugbot is set up for automated code reviews on this repo. Configure here.