Formualizer Docs
ReferenceFunctionsLookup Functions

PIVOTBY

PIVOTBY: Builds a pivot-style summary matrix from row fields, column fields, and values.

Summary

PIVOTBY aggregates intersections of row keys and column keys into a dynamic result grid.

Remarks

  • row_fields, col_fields, and values must have matching row counts.
  • Aggregation accepts text names (for example "SUM") or numeric codes.
  • Optional controls include header handling, row/column totals, and sort order.
  • Current implementation uses the first column of col_fields and values for aggregation.
  • Invalid setup returns #VALUE!.

Examples

Pivot sales by region and quarter
Grid
CellValue
Formula
=
Result
Not evaluated yet.
Expected
Pivot table with regions as rows and quarters as columns
Pivot with totals enabled
Grid
CellValue
Formula
=
Result
Not evaluated yet.
Expected
Pivot table including row and column totals

FAQ

What rows must align in PIVOTBY inputs?

row_fields, col_fields, and values must share the same row count; otherwise PIVOTBY returns #VALUE!.

What value range is currently aggregated?

Current implementation aggregates using the first value column (and first col_fields column for keys), so extra columns are not yet summarized independently.

Runtime metadata

Category

Lookup

Signature

PIVOTBY(arg1: Range (Range), arg2: Range (Range), arg3: Range (Range), arg4: Any, arg5?: Number, arg6?: Number, arg7?: Number, arg8?: Number, arg9?…: Number)

Arity

min 4, max variadic

Arguments

arg1by-ref

Range · Range

arg2by-ref

Range · Range

arg3by-ref

Range · Range

arg4

Any · Scalar

arg5optionaldefault

Number · Scalar · coercion NumberLenientText

arg6optionaldefault

Number · Scalar · coercion NumberLenientText

arg7optionaldefault

Number · Scalar · coercion NumberLenientText

arg8optionaldefault

Number · Scalar · coercion NumberLenientText

arg9optionaldefault

Number · Scalar · coercion NumberLenientText

Caps

PURE

Source

On this page