GROUPBY Function in Excel: A Pivot-Style Summary in One Formula

⏱ 1 min readUpdated 28 September 2026

Dynamic ArrayLevel: ExpertAvailable in: Excel 365 / 2021+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Example 2
  5. Related functions

GROUPBY groups rows by one or more columns and aggregates values — a live summary table that updates as data changes, without refreshing a pivot.

Syntax

=GROUPBY(row_fields, values, function, [field_headers], [total_depth], [sort_order], [filter_array])
Argument What it means
row_fields Column(s) to group by.
values Column(s) to aggregate.
function SUM, AVERAGE, COUNTA, MAX… or a LAMBDA.

Examples

Example 1

=GROUPBY(B2:B500, E2:E500, SUM)

Total sales per region with a grand total.

Example 2

=GROUPBY(B2:B500, E2:E500, SUM, , , -2)

Sorted by total, largest first.

💡 Point it at a Table column (Sales[Region]) so new rows are picked up automatically.

PIVOTBY · UNIQUE · SUMIFS

📚 Part of the free Excel course: Beginner → Expert · Try it in the Formula Lab or ask the AI Helper.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong