TX Sheet Control

GROUPBY Function

Function

Group the rows of data by one or more fields and aggregate the values of each group, with a total row. row_fields holds the values to group by, values the values to aggregate and function the aggregation, such as SUM, AVERAGE or COUNT. field_headers tells whether the first row holds headers (1 treats it as headers that are not shown), total_depth controls the totals (0 for none), sort_order sorts by a column of the result (a negative number sorts in descending order), and filter_array keeps only the rows with TRUE. The result spills.

Syntax

GROUPBY(row_fields, values, function, field_headers, total_depth, sort_order, filter_array, field_relationship)

Category: Lookup. Minimum arguments: 3. Maximum arguments: 8.

Available for supported offline calculation.

Examples

=GROUPBY({"A";"B";"A"},{2;3;4},SUM)

The formula spills A with 6, B with 3 and a Total row with 9.

Cell and range examples require appropriate input values in the referenced cells. Handle invalid arguments, formula errors and array and spill constraints.

See Also