Skip to content

Add KURT, MODE.SNGL, PERCENTRANK.EXC and TRIMMEAN functions - #1800

Open
marcin-kordas-hoc wants to merge 2 commits into
developfrom
feat/hf-stats-kurt-mode-trimmean-percentrank-exc
Open

marcin-kordas-hoc wants to merge 2 commits into
developfrom
feat/hf-stats-kurt-mode-trimmean-percentrank-exc

Conversation

@marcin-kordas-hoc

@marcin-kordas-hoc marcin-kordas-hoc commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds four statistical functions: KURT, MODE.SNGL (with the MODE alias), PERCENTRANK.EXC and TRIMMEAN (HF-427, HF-423, HF-422, HF-426).

  • KURT(number1, ...) returns the sample excess kurtosis. Requires at least 4 numeric values (#DIV/0! otherwise, and when all values are equal).
  • MODE.SNGL(number1, ...) returns the most frequent number; on a tie, the one that occurs first. #N/A when no value repeats.
  • PERCENTRANK.EXC(array, x, [significance]) returns the rank of x as a fraction between 0 and 1, exclusive, interpolating between neighbours.
  • TRIMMEAN(array, percent) returns the mean after trimming the given fraction of data points, split between both tails.
  • KURT, MODE.SNGL and TRIMMEAN live in StatisticalAggregationPlugin, PERCENTRANK.EXC in PercentilePlugin. Each has a metadata entry, translations in every language pack and a CHANGELOG entry.

Behaviour check against Excel

89 formulas were evaluated in Excel Online (MS Graph live session) and in HyperFormula: 89 identical, 0 different, 0 not evaluable. They cover typed numbers (percentage, date and currency cells), booleans, text and numeric text in ranges, errors in ranges, 2D ranges, tie order for MODE.SNGL, boundary and interpolated values and the significance argument for PERCENTRANK.EXC, and boundary and fractional percent values for TRIMMEAN. Numeric results are compared with a relative tolerance of 1e-9, because HyperFormula rounds results to about 11 significant digits.

Translations

The English function names are kept in all language packs. Confirmed localized names were not verified against Excel for this change, so none were invented.

Tests

Paired tests branch: feat/hf-stats-kurt-mode-trimmean-percentrank-exc in the tests repository (120 tests). Full local run on this head: 523 suites, 6735 passed, 3 skipped.

🤖 Generated with Claude Code


Note

Low Risk
Additive statistical functions with localized names and license gating; no changes to core engine, auth, or data handling.

Overview
Adds four Excel-style statistical functions: KURT, MODE.SNGL (with MODE alias), PERCENTRANK.EXC, and TRIMMEAN.

KURT, MODE.SNGL, and TRIMMEAN are implemented in StatisticalAggregationPlugin (sample excess kurtosis with a minimum of four values; mode with first-wins ties and #N/A when nothing repeats; trimmed mean with symmetric tail removal). PERCENTRANK.EXC lives in PercentilePlugin as the inverse of exclusive percentile ranking, with optional significance truncation and linear interpolation.

Supporting updates include function metadata, a new FourValues error message for KURT, English function names in all language packs, license capability entries, and a CHANGELOG note.

Reviewed by Cursor Bugbot for commit 5ee84a0. Bugbot is set up for automated code reviews on this repo. Configure here.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 8, 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 5ee84a0 Commit Preview URL

Branch Preview URL
Oct 09 2026, 05:00 AM

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ea79605. Configure here.

Comment thread src/interpreter/plugin/StatisticalAggregationPlugin.ts
Comment thread src/interpreter/plugin/PercentilePlugin.ts
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Performance comparison of head (5ee84a0) vs base (eff7928)

                                     testName |   base |   head | change
------------------------------------------------------------------------
                                      Sheet A |  296.3 | 279.72 | -5.60%
                                      Sheet B |  99.66 |  98.61 | -1.05%
                                      Sheet T |  84.51 |  84.54 | +0.04%
                                Column ranges | 315.83 | 313.88 | -0.62%
                                Sorted lookup | 9074.2 | 9429.5 | +3.92%
Sheet A:  change value, add/remove row/column |      9 |   9.03 | +0.33%
 Sheet B: change value, add/remove row/column |  80.37 |  82.79 | +3.01%
                   Column ranges - add column |   89.3 |  91.88 | +2.89%
                Column ranges - without batch | 289.07 | 295.12 | +2.09%
                        Column ranges - batch |     76 |  76.55 | +0.72%

marcin-kordas-hoc and others added 2 commits October 9, 2026 04:51
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@marcin-kordas-hoc
marcin-kordas-hoc force-pushed the feat/hf-stats-kurt-mode-trimmean-percentrank-exc branch from ea79605 to 5ee84a0 Compare October 9, 2026 04:57
@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.29%. Comparing base (eff7928) to head (5ee84a0).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1800      +/-   ##
===========================================
+ Coverage    97.28%   97.29%   +0.01%     
===========================================
  Files          207      207              
  Lines        16218    16285      +67     
  Branches      3588     3606      +18     
===========================================
+ Hits         15777    15844      +67     
  Misses         433      433              
  Partials         8        8              
Files with missing lines Coverage Δ
src/error-message.ts 100.00% <100.00%> (ø)
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% <ø> (ø)
... and 12 more
🚀 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.

This branch has not been deployed

No deployments
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