> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reducto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Types: layout and fonts: Formulas and names

## `Aggregate`

Not exported by name. You get it from the API.

```ts theme={null}
type Aggregate = "sum" | "count" | "average" | "max" | "min" | "product" | "countNums" | "stdDev" | "stdDevp" | "var" | "varp"
```

## `BinaryOp`

Not exported by name. You get it from the API.

```ts theme={null}
type BinaryOp = "+" | "-" | "*" | "/" | "^" | "&" | "=" | "<>" | "<" | ">" | "<=" | ">="
```

## `CalcOptions`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `cellInfo?` | `CellSource["cellInfo"]` | CELL's formatting types and INFO's workbook answers. |
| `custom?` | `CellSource["custom"]` | |
| `date1904?` | `boolean` | |
| `dynamic?` | `DynamicMetadata` | `cm` indexes that mark a dynamic array, the index to give a new one, and the `vm` for a rich error. |
| `filtered?` | `(sheet: number) => boolean` | Whether a filter with criteria is on the sheet; Excel then counts every hidden row there as filtered. |
| `image?` | `CellSource["image"]` | |
| `pivotData?` | `CellSource["pivotData"]` | |
| `tables?` | `(sheet: number \| null) => TableLookup \| undefined` | |

## `CalculationMode`

Not exported by name. You get it from the API.

```ts theme={null}
type CalculationMode = "Automatic" | "AutomaticExceptTables" | "Manual"
```

## `DefinedName`

Import from `@reductoai/xlsx`.

| Name | Type | Description |
| - | - | - |
| `name` | `string` | |
| `sheet` | `number \| null` | |
| `text` | `string` | |

## `EvalContext`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `array` | `boolean` | Operators lift element-wise instead of intersecting ranges. |
| `col` | `number` | |
| `onBind?` | `(name: Expr, value: Value) => void` | Sees each LET name as it is bound, for a formula editor that shows the values. |
| `plain?` | `boolean` | A pre-dynamic formula: array mode comes only from array parameters, and value parameters end it. |
| `row` | `number` | |
| `scope?` | `Scope` | LET and LAMBDA bindings in force. |
| `sheet` | `number` | |
| `source` | `CellSource` | |

## `Evaluated`

A single value, or the rows of a reference or an array.

Not exported by name. You get it from the API.

```ts theme={null}
type Evaluated = Scalar | Scalar[][]
```

## `Expr`

Relative coordinates are offsets from the formula cell, so one AST serves a shared-formula family.

Not exported by name. You get it from the API.

```ts theme={null}
type Expr = { kind: "number"; value: number } | { kind: "string"; value: string } | { kind: "boolean"; value: boolean } | { error: XlError; kind: "error" } | { at: RefEnd; kind: "ref"; sheet: number | null; text?: string } | { from: RefEnd; kind: "range"; sheet: number | null; text?: string; to: RefEnd; whole?: "rows" | "cols" } | { first: number; kind: "span"; last: number; ref: Extract<Expr, { kind: "range" }> } | { kind: "binary"; left: Expr; op: BinaryOp; right: Expr } | { arg: Expr; kind: "unary"; op: UnaryOp } | { args: Expr[]; kind: "call"; name: string } | { kind: "name"; name: string; sheet?: number } | { cols: number; data: Expr[]; kind: "array"; rows: number } | { kind: "missing" }
```

## `Formula`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `array` | `boolean` | Array formula (CSE or spill) filling `rows` x `cols` from its anchor. |
| `ast` | `Expr` | |
| `col` | `number` | |
| `cols` | `number` | |
| `row` | `number` | |
| `rows` | `number` | |
| `sheet` | `number` | |
| `spill` | `boolean` | Dynamic array: the area follows the result's size. |

## `FunctionArgSpec`

Import from `@reductoai/xlsx`.

| Name | Type | Description |
| - | - | - |
| `acceptErrors?` | `boolean` | An error in this argument goes to `compute`; otherwise the function gives that error. |
| `description?` | `string` | |
| `name` | `string` | |
| `optional?` | `boolean` | May be left out; `compute` then gets `null`. |
| `range?` | `boolean` | Takes the rows of a range; otherwise a range gives the value in the formula's row or column. |

## `FunctionImpl`

Not exported by name. You get it from the API.

```ts theme={null}
type FunctionImpl = (args: Expr[], ctx: EvalContext) => Value
```

## `Iteration`

Excel's iterative calculation (`calcPr iterate`): passes over circular cells until every change is below `delta`.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `count` | `number` | |
| `delta` | `number` | |

## `NamedStyleKind`

Not exported by name. You get it from the API.

```ts theme={null}
type NamedStyleKind = "table" | "pivot" | "slicer" | "timeline"
```

## `RefEnd`

Row and column of a reference end; `abs` ends do not move when the formula is filled.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `col` | `number` | |
| `colAbs` | `boolean` | |
| `row` | `number` | |
| `rowAbs` | `boolean` | |

## `Scalar`

A cell's content; `null` is an empty cell.

Not exported by name. You get it from the API.

```ts theme={null}
type Scalar = number | string | boolean | null | XlError
```

## `ScenarioCell`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `ref` | `string` | |
| `val` | `string` | |

## `ScenarioDef`

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `cells` | `ScenarioCell[]` | |
| `comment` | `string` | |
| `hidden` | `boolean` | |
| `locked` | `boolean` | |
| `name` | `string` | |
| `user` | `string` | |

## `ScenarioSet`

`current` and `show` index the scenario shown last; `sqref` is the last summary's result cells.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `current` | `number \| null` | |
| `items` | `ScenarioDef[]` | |
| `show` | `number \| null` | |
| `sqref` | `string` | |

## `SheetFormula`

`entered`: typed in this session, so it keeps dynamic-array semantics until saved even with a one-cell result.

Not exported by name. You get it from the API.

| Name | Type | Description |
| - | - | - |
| `attrs` | `string` | |
| `entered?` | `boolean` | |
| `text` | `string` | |

## `UnaryOp`

Not exported by name. You get it from the API.

```ts theme={null}
type UnaryOp = "-" | "+" | "%"
```

## `XlsxFunction`

A function a formula calls by name, such as `=ACME.QR(A1)`.

Import from `@reductoai/xlsx`.

| Name | Type | Description |
| - | - | - |
| `args` | `readonly FunctionArgSpec[]` | |
| `description?` | `string` | What AutoComplete, the ScreenTip and Insert Function show. |
| `example?` | `string` | A call Insert Function shows, such as `=ACME.QR("https://reducto.ai")`. |
| `helpUrl?` | `string` | An http or https page that "Help on this function" opens. |
| `maxAgeMs?` | `number` | A result this old (1000 or more) computes again, and the cells that show it update; the old one shows meanwhile. |
| `name` | `string` | A namespace, a dot and a name, as Excel add-ins name theirs: "ACME.QR". |
| `compute()` | `(args: FunctionArg[]) => FunctionResult \| PromiseLike<FunctionResult>` | Same arguments, same result. A thrown error or a rejected promise gives `#VALUE!`; rows spill. While a promise is pending the cell shows `#BUSY!`, or the result it had. |
