GROUPBY function
Summarize values by one or more grouping fields.
Group selected source records with a named aggregation or local LAMBDA. The eighth field_relationship argument chooses hierarchy (0/default) or table (1). Hierarchy sorting stays within parent groups and automatic totals include available subtotals; table sorting orders complete keys globally and supports grand totals only. Examples also cover signed sums, means, reducer vectors, headers and measure sorting. Native Excel recalculation and complete layout/coercion parity remain unverified.
Syntax
GROUPBY(row_fields, values, function, [field_headers], [total_depth], [sort_order], [filter_array], [field_relationship])Square brackets indicate optional arguments.
Arguments
| Argument | Required | Meaning |
|---|---|---|
| row_fields | Yes | Column or columns whose values define row groups. |
| values | Yes | Numeric data to summarize, aligned with the grouping fields. |
| function | Yes | The aggregation function or LAMBDA used for each group. |
| field_headers | No | Controls whether input headers exist and whether headers are returned. |
| total_depth | No | Controls the depth of subtotals and grand totals in the grouped result. |
| sort_order | No | Controls the grouping or value columns used to order the result. |
| filter_array | No | A Boolean filter aligned with source records; only included records are summarized. |
| field_relationship | No | Controls whether multiple grouping fields are treated hierarchically or as separate fields. |
Try GROUPBY
Group repeated regions without adding a grand total
=GROUPBY(A2:A6,B2:B6,SUM,0,0)Repeated regions are grouped and amounts are summed. East is 15, North is 0 and West is 18. The explicit options declare no input field headers and suppress totals. The complete two-column result is checked.
Inspect the current formula
Read its written arguments or observe actual operation values in a separate local calculation. This action neither applies a draft nor grades an answer.
Read the formula, one argument at a time
Explore the written function calls and their inputs. The calculation result belongs to the complete formula.
GROUPBY · top-level call
=GROUPBY(A2:A6,B2:B6,SUM,0,0)Follow the cells behind a result
Read explicit local references and helper formulas using a separate calculation. Your draft stays in this field; the worksheet and practice checks do not change.
The worksheet runs locally. Published checks apply to the supplied example only. Native Excel and Google Sheets compatibility remain unverified.
Practice a complete task
Reference and compatibility
Original SheetTutor reference notes / Microsoft documentation. Calculation checks cover the supplied examples only. The browser worksheet does not implement every Excel feature, external service or connected data type.