Skip to Content

GROUPBY

Creates a summary of your data using a grouping function to aggregate and organize information into categories

Syntax

GROUPBY(row_fields, values, function, [field_headers], [total_depth], [sort_order], [filter_array])

Parameters

  • row_fields: Required. A column-oriented array or range to group by
  • values: Required. A column-oriented array or range of data to aggregate
  • function: Required. A LAMBDA function to aggregate values (e.g., SUM, AVERAGE, COUNT)
  • field_headers: Optional. A number indicating whether data has headers (0=no, 1=yes, 2=auto, 3=yes but don't show)
  • total_depth: Optional. Determines whether grand totals and subtotals are shown (0=no totals, 1=grand total, 2=grand total and subtotals, -1=grand total at top, -2=all at top)
  • sort_order: Optional. A number indicating how to sort results
  • filter_array: Optional. A column-oriented 1D array of TRUE/FALSE to filter data

Example

=GROUPBY(A2:A20, C2:C20, SUM)
Returns: ArraySince: Microsoft 365