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, andvaluesmust 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_fieldsandvaluesfor aggregation. - Invalid setup returns
#VALUE!.
Examples
| Cell | Value | |
|---|---|---|
| Cell | Value | |
|---|---|---|
Related functions
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-refRange · Range
arg2by-refRange · Range
arg3by-refRange · Range
arg4Any · Scalar
arg5optionaldefaultNumber · Scalar · coercion NumberLenientText
arg6optionaldefaultNumber · Scalar · coercion NumberLenientText
arg7optionaldefaultNumber · Scalar · coercion NumberLenientText
arg8optionaldefaultNumber · Scalar · coercion NumberLenientText
arg9optionaldefaultNumber · Scalar · coercion NumberLenientText
Caps
Source