Sub topic 18
PivotTables, SUMPRODUCT, and other options
This chapter assumes you can write SUMIFS, COUNTIFS, and AVERAGEIFS with several criteria pairs and copy them with mixed references. The *IFS functions cover most conditional totals. A few jobs fit other tools better.
When the *IFS functions are the right choice
Use them when you need one answer per formula, the conditions are simple comparisons, and the result must update live inside a report layout you control. They are fast, easy to audit, and work on ranges or Excel tables.
PivotTables
A PivotTable is a tool that groups rows and summarizes them without formulas. Choose it when you want many totals at once, such as every region by every product, with subtotals and grand totals.
- You drag fields into rows, columns, and values. No criteria are typed.
- You can switch between sum, count, and average in seconds.
- You can group dates by month, quarter, or year.
- It does not refresh on its own. Use Data > Refresh All after the source changes.
Choose SUMIFS instead when the result must sit in a fixed layout, feed other formulas, or recalculate without a manual refresh.
SUMPRODUCT
SUMPRODUCT multiplies arrays and adds the results. It evaluates each condition as TRUE or FALSE for every row, so it can test things the *IFS functions cannot, such as a calculation on a column.
This formula totals January sales for the West region by testing the month of each date:
=SUMPRODUCT((B2:B100="West")*(MONTH(A2:A100)=1), D2:D100)Each test returns TRUE or FALSE. Multiplying converts them to 1 or 0, and D2:D100 is passed as a separate argument. If you multiply by D2:D100 directly, a text value in that column causes #VALUE!. Passed as a separate argument, text is treated as zero.
SUMPRODUCT also handles OR logic in one formula:
=SUMPRODUCT(((B2:B100="West")+(B2:B100="East"))*(D2:D100))The = comparison ignores letter case. For a case-sensitive match, use EXACT:
=SUMPRODUCT(--EXACT(B2:B100,"West"), D2:D100)SUMPRODUCT is slower on large ranges and harder to read. Prefer SUMIFS when it can do the job.
Choosing a tool
Common errors
- Forgetting to refresh a PivotTable, so it shows old totals.
- Multiplying a numeric range inside SUMPRODUCT, which fails when the range contains text.
- Using SUMPRODUCT on whole columns, which is slow.
Exercise
Column A holds dates, column B holds regions, and column D holds amounts in rows 2 to 100. You want the total Amount for West rows in March of any year. Which tool fits, and what is the formula?
Show answer
SUMIFS cannot test the month of a date directly, so use SUMPRODUCT: =SUMPRODUCT((B2:B100="West")*(MONTH(A2:A100)=3), D2:D100). A SUMIFS version would need a helper column holding the month.