Skip to content

Add RANK.EQ function and RANK alias (HF-419) - #1786

Open
marcin-kordas-hoc wants to merge 4 commits into
developfrom
feat/hf-419-rank-eq
Open

marcin-kordas-hoc wants to merge 4 commits into
developfrom
feat/hf-419-rank-eq

Conversation

@marcin-kordas-hoc

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

Copy link
Copy Markdown
Collaborator

Summary

Adds the RANK.EQ function and its RANK alias (HF-419).

  • RANK.EQ(number, ref, [order]) returns the rank of number within ref. Tied values share the top rank of their group. order omitted or 0 ranks descending, any other value ascending.
  • Only numeric cells of ref count: text, booleans, empty cells and numeric strings are ignored.
  • Returns #N/A when number is not found among the numeric cells, #VALUE! when number cannot be coerced to a number, and propagates an error found in ref.
  • Implemented in MedianPlugin, with a metadata catalogue entry, translations for all built-in languages, and a CHANGELOG entry.

Behaviour check against Excel

38 formulas were evaluated in Excel Online (MS Graph live session) and in HyperFormula: 37 identical, 0 different, 1 not evaluable in Excel (an inline array {1,2,3} as the list, which the Graph API rejects). They cover ties, both orders (0, non-zero, negative, boolean), booleans, text and numeric text in the list, typed numbers (percentage, date and currency cells, which an earlier head of this pull request dropped), an absent number, an empty number cell, single-cell and 2D lists, errors in the list, and a text or boolean number.

Numbers are compared exactly, as Excel does for ranking: with A1 = 0.1+0.2 and B1 = 0.3, RANK.EQ(0.3, A1:C1) is 3 in both (measured). COUNTIF and MATCH round and would treat them as equal; the rank functions do not.

Translations

Localized names follow the sources listed in DEV_DOCS.md. Where no confirmed localized name was available (cs, fi, hu, id, tr) the English name is kept. The Polish names were additionally checked in Excel.

Tests

Paired tests branch: feat/hf-419-rank-eq in the tests repository (45 tests). Full local run on this head: 503 suites, 6278 passed, 3 skipped.

🤖 Generated with Claude Code


Note

Low Risk
Additive built-in statistical function using the same plugin and licensing patterns as existing rank-adjacent functions; no changes to core engine or security-sensitive paths.

Overview
Adds RANK.EQ and the RANK alias so formulas can rank a value within a range, aligned with Excel-style behavior.

RANK.EQ(number, ref, [order]) is implemented in MedianPlugin (with LARGE/SMALL). It ranks using only numeric cells in ref, gives tied values the same top rank, defaults to descending order when order is omitted or 0, and returns #N/A when number is not among the numeric values. RANK resolves to RANK.EQ via the plugin alias map.

Supporting updates wire the function into the catalog: statistical function metadata, localized names across built-in language packs, inclusion in proprietary license function capabilities, and a CHANGELOG entry.

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

@cloudflare-workers-and-pages

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

Branch Preview URL
Oct 08 2026, 04:11 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 1 potential issue.

Fix All in Cursor

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

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 60b087b. Configure here.

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

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Performance comparison of head (aef06a6) vs base (3a9c34b)

                                     testName |    base |    head | change
--------------------------------------------------------------------------
                                      Sheet A |  500.93 |  502.84 | +0.38%
                                      Sheet B |  168.36 |  163.76 | -2.73%
                                      Sheet T |  145.21 |  145.32 | +0.08%
                                Column ranges |  482.36 |  485.09 | +0.57%
                                Sorted lookup | 15219.2 | 14172.7 | -6.88%
Sheet A:  change value, add/remove row/column |   17.85 |   17.12 | -4.09%
 Sheet B: change value, add/remove row/column |  147.85 |  148.35 | +0.34%
                   Column ranges - add column |  154.31 |  160.19 | +3.81%
                Column ranges - without batch |  479.36 |  480.91 | +0.32%
                        Column ranges - batch |  120.65 |  120.28 | -0.31%

marcin-kordas-hoc and others added 4 commits October 8, 2026 03:52
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.26%. Comparing base (3a9c34b) to head (aef06a6).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #1786   +/-   ##
========================================
  Coverage    97.26%   97.26%           
========================================
  Files          203      203           
  Lines        16022    16034   +12     
  Branches      3555     3558    +3     
========================================
+ Hits         15583    15595   +12     
  Misses         431      431           
  Partials         8        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 10 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