GROUPBY builds a grouped summary — like a one-formula PivotTable. Give it the grouping column, the values, and an aggregation, and it spills totals per group, sorted and ready.
The example
Sales totaled by region.
| A | B | |
|---|---|---|
| 1 | Region | Sales |
| 2 | East | 42,000 |
| 3 | West | 38,500 |
The formula
Group, then aggregate:
How it works
GROUPBY does grouping + aggregation in one step:
- First argument: the row field to group by (e.g. Region).
- Second: the values to aggregate.
- Third: the function — SUM, AVERAGE, COUNT, or a custom LAMBDA.
- Optional arguments add totals, sort order, and even a second grouping level. The result spills and updates live.
A formula PivotTable. GROUPBY (and its cousin PIVOTBY) give pivot-style summaries that recalc automatically — no refresh, no GETPIVOTDATA. They’re a 2024 addition to Excel 365; where unavailable, SUMIFS over a UNIQUE list is the classic equivalent.
Try it: interactive demo
Lines “region,sales” → totals by region.
Variations
Average instead
Swap the function:
Add totals
Include a grand total row.
SUMIFS equivalent
Pre-2024:
Pitfalls & errors
365 (2024+) only. GROUPBY is brand new; many installs don’t have it yet — use SUMIFS+UNIQUE there.
Spill space. The grouped table spills; clear room or get #SPILL!.
Field arguments are columns. Pass single-column ranges for the group and values; mismatched sizes error.
Practice workbook
Frequently asked questions
How do I summarize data by group with a formula in Excel?
What if I don't have GROUPBY?
Can GROUPBY use a different aggregation?
Stop fighting formulas. Learn them in a day.
This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.
See the Formulas & Functions Class