Excel PIVOTBY Function
Chala mitrano — today we learn PIVOTBY. Read Why → What → How, then try the practice list.
चला मित्रांनो — आज PIVOTBY शिकू. Why → What → How वाचा, मग practice करा.
चलो दोस्तों — आज PIVOTBY सीखते हैं। Why → What → How पढ़ो, फिर practice करो।
Purpose
Create a Pivot-like summary with row and column fields that spills as a dynamic array (Excel 365).
Return value
A spilled pivot-style grid (headers + aggregates).
Syntax
Arguments
| Argument | Required? | Description |
|---|---|---|
row_fields | Required | Columns that become row groups. |
col_fields | Required | Columns that become column groups (can be empty handling depends on build). |
values | Required | Numbers to aggregate. |
function | Required | Aggregate such as SUM, AVERAGE. |
Version
Microsoft 365 (newer builds). Companion to GROUPBY. Check your Version channel.
How to use — Why → What → How
Why: GROUPBY is great for row groups. PIVOTBY adds column fields like a classic PivotTable — without the Pivot cache UI.
What: One formula spills a matrix summary you can feed to charts.
How — numbered steps:
- Put data in a Table.
- Try a simple PIVOTBY with region rows and month columns.
- Compare to Insert → PivotTable for the same question.
- Watch #SPILL! room below and right.
- Prefer PivotTables when users must drag fields interactively.
Ravindra Bagale's Tip
PIVOTBY is formula-first; PivotTables are UI-first. Teach both.
Ravindra Bagale's Tip – मराठी
PIVOTBY सूत्र-first; PivotTable UI-first. दोन्ही शिकवा.
Ravindra Bagale's Tip – हिंदी
PIVOTBY फ़ॉर्मूला-first; PivotTable UI-first। दोनों सिखाओ।
Ravindra Bagale's Tip
If your Excel build lacks PIVOTBY, upgrade 365 or use PivotTable + GROUPBY.
Ravindra Bagale's Tip – मराठी
PIVOTBY नसेल तर 365 अपडेट किंवा PivotTable वापरा.
Ravindra Bagale's Tip – हिंदी
PIVOTBY न हो तो 365 अपडेट या PivotTable।
Worked examples
1) Region × Category sales
Nashik sales table.
Result: Matrix of sums
What it means: Rows=region, cols=category.
2) Average score by class and term
School sheet.
Result: Average matrix
What it means: AVERAGE aggregate.
3) Count of orders
Use COUNTA/COUNT via supported function list.
Result: Counts
What it means: Verify function support on your build.
4) UK cafe £ by daypart × item
Leeds.
Result: £ matrix
What it means: Same pattern, pounds.
5) Side-by-side with GROUPBY
Compare layouts.
Result: Two views
What it means: Choose the shape your manager wants.
Common errors
Practice tasks (10+)
- Task 1. Build a tiny PIVOTBY on 12 sample rows.Hint: try on a tiny range first
- Task 2. Compare to a PivotTable on the same data.Hint: try on a tiny range first
- Task 3. Change aggregate SUM → AVERAGE.Hint: try on a tiny range first
- Task 4. Explain #NAME? on older Excel.Hint: try on a tiny range first
- Task 5. Chart a PIVOTBY output.Hint: try on a tiny range first
- Task 6. Interview: PIVOTBY vs GROUPBY.Hint: try on a tiny range first
- Task 7. Ensure ranges are same height.Hint: try on a tiny range first
- Task 8. Document your Excel version in the file.Hint: try on a tiny range first
- Task 9. Try empty column field behaviour on your build.Hint: try on a tiny range first
- Task 10. Bonus: wrap with ROUND for display.Hint: try on a tiny range first
Quick quiz
Answers: Q1=True, Q2=False, Q3=True, Q4=True
Related: LAMBDA · LET · GROUPBY · Function hub · Learning path