Lookup & reference

GROUPBY function

Group rows and aggregate their values. GROUPBY works in Sheets with the usual arguments and results, on cells and on live data from the tools you connect.

Syntax

=GROUPBY(row_fields, values, function, [field_headers], [total_depth], [sort_order], [filter_array], [field_relationship])
ArgumentUse
row_fieldsrequired
valuesrequired
functionrequired
field_headersoptional
total_depthoptional
sort_orderoptional
filter_arrayoptional
field_relationshipoptional

On live data

In Sheets, GROUPBY sits next to live data from a connected tool: =data.orders.sum(total) totals a table, =list.orders(customer) spills a column's distinct values, and a linked table column such as table.orders[Total] is a range any function accepts.

See the integrations

More lookup & reference functions

All 37 lookup & reference functions →

Spreadsheet formulas on live business data

Sheets evaluates 491 spreadsheet functions, on cells and on data read live from your tools.