Loading documentation…
Loading documentation…
This page lists the 17 functions of the logical and control flow family. Taxonomy/source: Logical functions. The formula function contract has every family, the engine builds, and the evaluation limits.
All functions
| Function (aliases) | Engine | Contract |
|---|---|---|
IF | Default + full | |
AND | Default + full | |
OR | Default + full | |
NOT | Default + full | |
IFS | Default + full | |
SWITCH | Default + full | |
XOR | Default + full | |
TRUE | Default + full | |
FALSE | Default + full | |
LET | Default + full | |
LAMBDA | Full only | |
MAP | Full only | |
REDUCE | Full only | |
SCAN | Full only | |
BYROW | Full only | |
BYCOL | Full only | |
MAKEARRAY | Full only |
Argument order, required/default state, accepted shapes, repetition, and return shape come directly from the inventory.
Return shape: contextual.
| Argument | Required | Default | Accepts | Repetition |
|---|---|---|---|---|
logicalTest | yes | none | scalar, reference | once |
valueIfTrue | no | true | scalar, range, array, reference | once |
valueIfFalse | no | false | scalar, range, array, reference | once |
Return shape: scalar.
| Argument | Required | Default | Accepts | Repetition |
|---|---|---|---|---|
logical | yes | none | scalar, range, array, reference | one-or-more |
Return shape: scalar.
| Argument | Required | Default | Accepts | Repetition |
|---|---|---|---|---|
value | yes | none | scalar, range, array, reference | once |
Return shape: contextual.
| Argument | Required | Default | Accepts | Repetition |
|---|---|---|---|---|
testAndValue | yes | none | scalar, range, array, reference | paired |
Return shape: contextual.
| Argument | Required | Default | Accepts | Repetition |
|---|---|---|---|---|
expression | yes | none | scalar, reference | once |
valueAndResult | yes | none | scalar, range, array, reference | paired |
defaultValue | no | #N/A | scalar, range, array, reference | once |
Return shape: scalar.
| Argument | Required | Default | Accepts | Repetition |
|---|---|---|---|---|
| none | — | — | — | — |
Return shape: contextual.
| Argument | Required | Default | Accepts | Repetition |
|---|---|---|---|---|
nameAndValue | yes | none | scalar, range, array, name, reference | paired |
calculation | yes | none | scalar, range, array, name, reference | once |
Return shape: contextual.
| Argument | Required | Default | Accepts | Repetition |
|---|---|---|---|---|
parameter | no | none | scalar, range, array, reference | zero-or-more |
calculation | yes | none | scalar, range, array, reference | once |
Return shape: array.
| Argument | Required | Default | Accepts | Repetition |
|---|---|---|---|---|
array | yes | none | scalar, range, array, reference | one-or-more |
lambda | yes | none | scalar, range, array, reference | once |
Return shape: scalar.
| Argument | Required | Default | Accepts | Repetition |
|---|---|---|---|---|
initialValue | no | none | scalar, range, array, reference | once |
array | yes | none | scalar, range, array, reference | once |
lambda | yes | none | scalar, range, array, reference | once |
Return shape: array.
| Argument | Required | Default | Accepts | Repetition |
|---|---|---|---|---|
initialValue | no | none | scalar, range, array, reference | once |
array | yes | none | scalar, range, array, reference | once |
lambda | yes | none | scalar, range, array, reference | once |
Return shape: array.
| Argument | Required | Default | Accepts | Repetition |
|---|---|---|---|---|
array | yes | none | scalar, range, array, reference | once |
lambda | yes | none | scalar, range, array, reference | once |
Return shape: array.
| Argument | Required | Default | Accepts | Repetition |
|---|---|---|---|---|
array | yes | none | scalar, range, array, reference | once |
lambda | yes | none | scalar, range, array, reference | once |
Return shape: array.
| Argument | Required | Default | Accepts | Repetition |
|---|---|---|---|---|
rows | yes | none | scalar, range, array, reference | once |
columns | yes | none | scalar, range, array, reference | once |
lambda | yes | none | scalar, range, array, reference | once |
These values are normative for the listed Sheetwrite subset. function-defined and contextual are explicit limitations: consult the formula guides' function-specific sections rather than assuming another spreadsheet's edge behavior.
| Dimension | Contract |
|---|---|
| shape | scalar: accepted range: contextual array: contextual broadcast: function-defined result: contextual |
| coercion | blank: function-defined text: function-defined boolean: function-defined error: trap-selected |
| text | case: insensitive wildcard: literal |
| environment | locale: invariant dateSystem: function-defined |
| numeric | tolerance: function-defined domain: function-defined iteration: kind: none maximum: none |
| calculation | dependencies: contextual lazy: lazy-branches spill: contextual fill: relative-reference-rewrite copy: relative-reference-rewrite structuralRewrite: ast-reference-rewrite |
| persistence | snapshot: formula-source history: formula-source collaboration: formula-source xlsxSource: rewrite-on-structural-edit |
| Dimension | Contract |
|---|---|
| shape | scalar: accepted range: accepted array: contextual broadcast: function-defined result: scalar |
| coercion | blank: false text: function-defined boolean: preserved error: propagate |
| text | case: insensitive wildcard: literal |
| environment | locale: invariant dateSystem: not-applicable |
| numeric | tolerance: exact domain: all-inputs iteration: kind: none maximum: none |
| calculation | dependencies: tracked lazy: eager spill: scalar fill: relative-reference-rewrite copy: relative-reference-rewrite structuralRewrite: ast-reference-rewrite |
| persistence | snapshot: formula-source history: formula-source collaboration: formula-source xlsxSource: rewrite-on-structural-edit |
| Dimension | Contract |
|---|---|
| shape | scalar: accepted range: accepted array: accepted broadcast: function-defined result: contextual |
| coercion | blank: preserved text: preserved boolean: preserved error: propagate |
| text | case: insensitive wildcard: literal |
| environment | locale: invariant dateSystem: function-defined |
| numeric | tolerance: function-defined domain: function-defined iteration: kind: none maximum: none |
| calculation | dependencies: contextual lazy: lazy-bindings spill: contextual fill: relative-reference-rewrite copy: relative-reference-rewrite structuralRewrite: ast-reference-rewrite |
| persistence | snapshot: formula-source history: formula-source collaboration: formula-source xlsxSource: rewrite-on-structural-edit |
| Dimension | Contract |
|---|---|
| shape | scalar: accepted range: accepted array: accepted broadcast: none result: contextual |
| coercion | blank: function-defined text: function-defined boolean: function-defined error: propagate |
| text | case: not-applicable wildcard: not-applicable |
| environment | locale: invariant dateSystem: not-applicable |
| numeric | tolerance: binary64 domain: function-defined iteration: kind: bounded maximum: 2000000 |
| calculation | dependencies: tracked lazy: function-defined spill: contextual fill: relative-reference-rewrite copy: relative-reference-rewrite structuralRewrite: ast-reference-rewrite |
| persistence | snapshot: formula-source history: formula-source collaboration: formula-source xlsxSource: rewrite-on-structural-edit |
| Dialect | Status |
|---|---|
| Microsoft Excel | documented |
| Google Sheets | unverified |
| OpenFormula | unverified |
Limitations: Google Sheets and OpenFormula results require producer evidence before compatibility is claimed.
| Dialect | Status |
|---|---|
| Microsoft Excel | documented |
| Google Sheets | unverified |
| OpenFormula | unverified |
Limitations: Available only in @sheetwrite/formulas. Named ranges are supported, but workbook-defined named formulas are not available. LAMBDA uses lexical parameters and LET bindings. Calls are limited to depth 64 and 2000000 work units. Helpers reject nested arrays.
| Layer | Status and source/evidence |
|---|---|
| Parser | implementedpackages/wasm/src/calc.rs |
| Evaluator | implementedpackages/wasm/src/eval/mod.rspackages/wasm/src/eval/functions.rs |
| Formula assist | implementedpackages/core/src/formula-assist.ts |
| Evidence | source-linkedpackages/wasm/src/tests.rspackages/core/test/formula-assist.test.ts |
| Layer | Status and source/evidence |
|---|---|
| Parser | implementedpackages/wasm/src/calc.rs |
| Evaluator | implementedpackages/wasm/src/eval/analysis/lambda.rs |
| Formula assist | implementedpackages/core/src/formula-assist.ts |
| Evidence | source-linkedpackages/wasm/src/eval/analysis/lambda.rs |