You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(guide): document named ranges in formulas + fix limitations pointer (HF-222)
Adds a 'Using named ranges in formulas' section to named-expressions.md (behavior as function arg / operator operand / bare ref, incl. array mode) and replaces the inaccurate top-level named-ranges bullet in known-limitations.md with a neutral pointer. Docs-only.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/guide/known-limitations.md
+1-37Lines changed: 1 addition & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,9 +14,7 @@ the full evaluation of expressions and condition statements. The
14
14
most prominent example of this behavior is the "IF" function which
15
15
returns a cycle error regardless of whether TRUE or FALSE causes
16
16
a circular reference.
17
-
* There is no data validation against named ranges. For example,
18
-
you can't compare the arguments in a formula like this:
19
-
=IF(firstRange>secondRange, TRUE, FALSE).
17
+
* Named ranges behave differently depending on where they are used in a formula. For details, see [Using named ranges in formulas](named-expressions.md#using-named-ranges-in-formulas).
20
18
*[Custom functions](custom-functions.md) don't automatically recalculate the size of their [result arrays](custom-functions.md#return-an-array-of-data) when the formula dependencies change.
21
19
* There is no relative referencing in named ranges.
22
20
* The library doesn't offer (at least not yet) the following features:
@@ -38,37 +36,3 @@ you can't compare the arguments in a formula like this:
38
36
* The INDEX function doesn't support returning whole rows or columns of the source range – it always returns the contents of a single cell.
39
37
* The FILTER function accepts either single rows of equal width or single columns of equal height. In other words, all arrays passed to the FILTER function must have equal dimensions, and at least one of those dimensions must be 1.
40
38
* Array-producing functions (e.g., SEQUENCE, FILTER) require their output dimensions to be determinable at parse time. Passing cell references or formulas as dimension arguments (e.g., `=SEQUENCE(A1)`) results in a `#VALUE!` error, because the output size cannot be resolved before evaluation.
41
-
42
-
### OFFSET function
43
-
44
-
HyperFormula resolves the OFFSET function at parse time rather than during evaluation. The parser inspects the arguments and rewrites the expression into a plain cell reference or range. This keeps the dependency graph accurate but imposes several restrictions.
45
-
46
-
* The first argument must be a reference to a single cell. Passing a range causes the cell to store a parser error (the API call itself does not throw — read the error via `getCellValue`).
47
-
48
-
```js
49
-
// Cell A1 stores a parser error — the first argument must be a single cell, not a range
* The row-shift, column-shift, height, and width arguments must be static integer literals known at parse time. Cell references and formulas passed as shift or size arguments cause the cell to store a parser error.
54
-
55
-
```js
56
-
// Cell A1 stores a parser error — the row-shift argument must be a static integer literal
* The height and width arguments must be bare positive integer literals (the parser accepts only `NUMBER` AST nodes). Unary `+` prefixes, parenthesised expressions, values less than 1, and non-integer values are rejected at parse time.
61
-
62
-
* When the computed target falls outside the sheet, the parser stores a `#REF!` error in the cell at parse time (rather than during evaluation) with the message *Resulting reference is out of the sheet*.
A named expression that resolves to a range of cells behaves differently depending on where it is used:
93
+
94
+
-**As a function argument** — it works as expected. `=SUM(myRange)`, `=COUNT(myRange)`, and `=INDEX(myRange, 1, 1)` all operate on the full range.
95
+
-**As an operand of an operator** — the range is reduced to a single cell before the operation. In `=myRange + 1`, only the cell of the range that shares the formula's row (for a vertical range) or column (for a horizontal range) is used. If the formula's row or column falls outside the range, or the range is two-dimensional, the result is a `#VALUE!` error.
96
+
-**As a bare reference** — `=myRange` on its own returns a `#VALUE!` error; a range cannot be placed directly into a single cell.
97
+
98
+
The range is reduced before the operator runs, so `=SUM(myRange + 1)` receives a single value rather than adding 1 to every element.
99
+
100
+
When array arithmetic is enabled (`useArrayArithmetic: true`), named ranges still work as function arguments and aggregate correctly, but they do not spill: `=myRange + 1` returns a `#VALUE!` error rather than producing one result per element.
101
+
90
102
## Available methods
91
103
92
104
These are the basic methods that can be used to add and manipulate named
0 commit comments