Skip to content

Feature/averageifs function - #1732

Open
Tobiadefami wants to merge 4 commits into
developfrom
feature/averageifs-function
Open

Feature/averageifs function#1732
Tobiadefami wants to merge 4 commits into
developfrom
feature/averageifs-function

Conversation

@Tobiadefami

@Tobiadefami Tobiadefami commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Context

HyperFormula supports AVERAGEIF and other conditional aggregation functions, but it does not support AVERAGEIFS.

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:

  • Required and repeated arguments.
  • Invalid criteria and mismatched range dimensions.
  • Single and multiple criteria.
  • Scalar, reference, range, and calculated-range arguments.
  • Error propagation.
  • Ignoring non-numeric values in the average range.
  • Division-by-zero errors when no numeric values qualify.
  • Valid averages equal to zero.
  • Conditional aggregation caching.
  • Recalculation after changes to the average or criteria ranges.
  • Public function metadata.
  • The Portuguese translation.

All 28 focused tests passed.

Additionally, I ran:

  • npm run bundle:cjs
  • npm run docs:generate-function-docs

Both commands completed successfully.

Types of changes

  • Breaking change (a fix or a feature because of which an existing functionality doesn't work as
    expected anymore)
  • New feature or improvement (a non-breaking change that adds functionality)
  • Bug fix (a non-breaking change that fixes an issue)
  • Additional language file, or a change to an existing language file (translations)
  • Change to the documentation

Related issues:

Checklist:

  • I have reviewed the guidelines about [Contributing to HyperFormula](https://
    hyperformula.handsontable.com/guide/contributing.html) and I confirm that my code follows the code style of
    this project.
  • I have signed the Contributor License Agreement.
  • My change is compliant with the [OpenDocument](https://docs.oasis-open.org/office/OpenDocument/v1.3/
    os/part4-formula/OpenDocument-v1.3-os-part4-formula.html) standard.
  • My change is compatible with Microsoft Excel.
  • My change is compatible with Google Sheets.
  • I described my changes in the [CHANGELOG.md](https://github.com/handsontable/hyperformula/blob/master/
    CHANGELOG.md) file.
  • My changes require a documentation update.
  • My changes require a migration guide.

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 / AVERAGEIF pattern.

Implementation wires averageifs in ConditionalAggregationPlugin through computeConditionalAggregationFunction with AverageResult composition, repeatLastArgs: 2 for 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.

@cla-external-contractor-signup

Copy link
Copy Markdown

@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.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 13, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@Tobiadefami
Tobiadefami requested a review from sequba August 13, 2026 09:08
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.31%. Comparing base (61ead73) to head (8f54b3a).

Additional details and impacted files

Impacted file tree graph

@@           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     
Files with missing lines Coverage Δ
src/i18n/languages/csCZ.ts 100.00% <ø> (ø)
src/i18n/languages/daDK.ts 100.00% <ø> (ø)
src/i18n/languages/deDE.ts 100.00% <ø> (ø)
src/i18n/languages/enGB.ts 100.00% <ø> (ø)
src/i18n/languages/esES.ts 100.00% <ø> (ø)
src/i18n/languages/fiFI.ts 100.00% <ø> (ø)
src/i18n/languages/frFR.ts 100.00% <ø> (ø)
src/i18n/languages/huHU.ts 100.00% <ø> (ø)
src/i18n/languages/idID.ts 100.00% <ø> (ø)
src/i18n/languages/itIT.ts 100.00% <ø> (ø)
... and 9 more

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown

Performance comparison of head (8f54b3a) vs base (61ead73)

                                     testName |    base |    head | change
--------------------------------------------------------------------------
                                      Sheet A |  504.43 |  489.18 | -3.02%
                                      Sheet B |  165.44 |  160.25 | -3.14%
                                      Sheet T |  144.35 |  140.02 | -3.00%
                                Column ranges |  531.09 |  520.14 | -2.06%
                                Sorted lookup | 15846.1 | 15836.9 | -0.06%
Sheet A:  change value, add/remove row/column |   16.93 |   16.91 | -0.12%
 Sheet B: change value, add/remove row/column |  153.33 |  141.33 | -7.83%
                   Column ranges - add column |  164.26 |  159.02 | -3.19%
                Column ranges - without batch |  483.76 |  500.67 | +3.50%
                        Column ranges - batch |  124.29 |  127.76 | +2.79%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant