SORTBY Function
📊 Process Flow to Use the
GROUPBY Function in Excel
✅ Step 1: Identify Columns for
Grouping
- Choose
the column that contains categories to group by.
- Example:
B2:B357 = Product Name
✅ Step 2: Identify Column to
Aggregate
- Select
the column that has the numeric values you want to summarize.
- Example:
C2:C357 = Sales QTY
✅ Step 3: Decide Aggregation
Function
- Pick
an aggregation function such as:
- SUM,
AVERAGE, COUNT, MAX, MIN
- Example:
Use SUM to total the sales per product.
✅ Step 4: Choose Output Cell
- Select
the top-left cell where the grouped results should appear.
- Example:
Start in cell E2
✅ Step 5: Enter the GROUPBY
Formula
=GROUPBY(B2:B357, C2:C357, SUM)
- B2:B357:
Group by product names
- C2:C357:
Aggregate sales quantities
- SUM:
Aggregation function used
✅ Step 6: Press Enter
- Hit Enter
to apply the function.
- Excel
will output:
- Column
1: Unique product names
- Column
2: Summed sales for each product
💡 Optional Arguments You
Can Use
- col_fields:
Additional grouping across columns
- headers:
Indicate whether source has headers (0, 1, -1)
- total_row:
Add total or subtotal labels
- sort_order:
Specify sorting preferences
- filter_array:
Apply filters to source data before grouping
🧠Use Case Example
If you want to know total sales per product from a
list of daily sales entries, GROUPBY lets you do this without needing a
PivotTable — fully dynamic and formula-based!