Skip to content

Add TYPE and ERROR.TYPE functions (HF-488, HF-489) - #1813

Open
marcin-kordas-hoc wants to merge 8 commits into
developfrom
feat/hf-type-error-type
Open

marcin-kordas-hoc wants to merge 8 commits into
developfrom
feat/hf-type-error-type

Conversation

@marcin-kordas-hoc

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

Copy link
Copy Markdown
Collaborator

Summary

Adds two information functions: TYPE and ERROR.TYPE (HF-488, HF-489).

  • TYPE(value) returns 1 for a number, 2 for text, 4 for a boolean, 16 for an error and 64 for an array or a multi-cell range. A single-cell reference is read as its value, so a blank cell gives 1.
  • ERROR.TYPE(error_val) returns the code of an error: #DIV/0! 2, #VALUE! 3, #REF! 4, #NAME? 5, #NUM! 6, #N/A 7, #SPILL! 9. Any other value, including a blank cell or an error without a code, gives #N/A.
  • Implemented in InformationPlugin, with metadata, translations, the license capability table entries, two rows in docs/guide/list-of-differences.md and a CHANGELOG entry.

Behaviour check against Excel

74 formulas were evaluated in Excel Online (MS Graph live session) and in HyperFormula: 73 identical, 1 different, 0 not evaluable. They cover numbers, text, booleans, errors of every kind HyperFormula has, typed numbers (percentage and date cells), blank cells, formulas that return text, multi-cell and whole-column ranges for TYPE, and nested calls. Later runs measured a blocked spill (Excel returns 9 from ERROR.TYPE, and so does HyperFormula now), 11 more TYPE formulas over ROW, COLUMN and a single-cell range (all identical), and 5 TYPE formulas over computed arrays.

The differences, both listed in docs/guide/list-of-differences.md:

  • ERROR.TYPE(#NULL!): Excel returns 1. HyperFormula has no #NULL! error and cannot parse the literal. #CYCLE!, which Excel does not have, gives #N/A.
  • TYPE of a computed array: Excel returns 64 for ROW(A1:A2)+0, A1:A2+1 and IF(TRUE(), A1:A2). HyperFormula gives 1 for ROW(A1:A2)+0. With useArrayArithmetic set to true it gives 64 for the other two; with the default false the range is reduced to the cell in the formula's row, so TYPE classifies that cell's value, or gives 16 (#VALUE!) outside the range's rows.

ERROR.TYPE over a multi-cell range depends on how the result spills in Excel, so it is not asserted.

Translations

Each localized name was checked on Microsoft's page for the function in that language (support.microsoft.com/<locale>/excel/functions/<function>): for all 15 languages and both functions, the name used here is in the page's title or heading and in its syntax line. On the Swedish ERROR.TYPE page the heading shows the English name, while the title and the syntax show FEL.TYP. enGB and idID keep the English names, which their Microsoft pages also use.

Tests

Paired tests branch: feat/hf-type-error-type in the tests repository (35 tests, including one that parses the German TYP and one that parses the Polish NR.BŁĘDU). All 35 fail against develop. Full local run on this head: 522 suites, 6777 passed, 3 skipped.

🤖 Generated with Claude Code


Note

Low Risk
Adds two self-contained information functions in InformationPlugin with documented Excel deltas; no auth, persistence, or core calculation pipeline changes.

Overview
Adds Excel-style TYPE and ERROR.TYPE information functions to the formula engine.

TYPE(value) returns numeric type codes (1 number/empty, 2 text, 4 boolean, 16 error, 64 array/range). Errors are classified instead of bubbling. Multi-cell ranges and a special case treat ROW/COLUMN over a multi-cell range as array type (64) for Excel parity. ERROR.TYPE(value) maps HyperFormula error kinds to Excel codes (2–7, 9 for #SPILL!) and returns #N/A for non-errors or errors without a code (e.g. #CYCLE!).

Supporting updates: function metadata, 15 locale names, license capability entries, CHANGELOG, and list-of-differences notes for #NULL!, #CYCLE!, and computed-array TYPE behavior vs Excel/useArrayArithmetic.

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

marcin-kordas-hoc and others added 2 commits October 14, 2026 23:50
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Oct 14, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@cloudflare-workers-and-pages

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

Branch Preview URL
Oct 23 2026, 08:33 AM

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Performance comparison of head (4701090) vs base (d143456)

                                     testName |    base |    head |  change
---------------------------------------------------------------------------
                                      Sheet A |  304.65 |  319.26 |  +4.80%
                                      Sheet B |   94.46 |   99.02 |  +4.83%
                                      Sheet T |   87.09 |   92.86 |  +6.63%
                                Column ranges |  444.06 |  463.81 |  +4.45%
                                Sorted lookup | 15495.2 | 15259.2 |  -1.52%
Sheet A:  change value, add/remove row/column |    9.02 |    9.91 |  +9.87%
 Sheet B: change value, add/remove row/column |   86.75 |   88.51 |  +2.03%
                   Column ranges - add column |  112.87 |   117.7 |  +4.28%
                Column ranges - without batch |  370.24 |  371.89 |  +0.45%
                        Column ranges - batch |   97.24 |   86.32 | -11.23%

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Oct 15, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

…e measured Excel results

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Oct 15, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

marcin-kordas-hoc and others added 2 commits October 23, 2026 00:00
…s in the Excel column

The two new rows of the list of differences had the Excel results in the Google Sheets column.
The TYPE row now also says that, without array arithmetic, a computed range is reduced to the
cell in the formula's row, so TYPE gives 1 or 16 depending on where the formula sits.
The ERROR.TYPE description lists 9 for #SPILL!.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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

Reviewed by Cursor Bugbot for commit c1302d0. Configure here.

Comment thread hyperformula/src/interpreter/plugin/InformationPlugin.ts
marcin-kordas-hoc and others added 2 commits October 23, 2026 00:22
…ways a number

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s instead of throwing

Building the range of a sheet-spanning reference threw SheetsNotEqual out of evaluation.
Such a reference makes ROW and COLUMN return #REF!, so TYPE now classifies it as an error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.28%. Comparing base (d143456) to head (4701090).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #1813   +/-   ##
========================================
  Coverage    97.28%   97.28%           
========================================
  Files          207      207           
  Lines        16218    16264   +46     
  Branches      3556     3602   +46     
========================================
+ Hits         15777    15823   +46     
  Misses         433      433           
  Partials         8        8           
Files with missing lines Coverage Δ
hyperformula/src/i18n/languages/csCZ.ts 100.00% <ø> (ø)
hyperformula/src/i18n/languages/daDK.ts 100.00% <ø> (ø)
hyperformula/src/i18n/languages/deDE.ts 100.00% <ø> (ø)
hyperformula/src/i18n/languages/enGB.ts 100.00% <ø> (ø)
hyperformula/src/i18n/languages/esES.ts 100.00% <ø> (ø)
hyperformula/src/i18n/languages/fiFI.ts 100.00% <ø> (ø)
hyperformula/src/i18n/languages/frFR.ts 100.00% <ø> (ø)
hyperformula/src/i18n/languages/huHU.ts 100.00% <ø> (ø)
hyperformula/src/i18n/languages/idID.ts 100.00% <ø> (ø)
hyperformula/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