Use Excel SUMPRODUCT to Sum a Matrix by Row and Column Criteria
Question details
Calculate totals in a matrix when both an employee row label and a column heading must match specified criteria.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Create a summary table of overtime, vacation, or other numeric values for each employee.
- Observed behavior
- The desired result is a total of numeric cells whose row and column headers match the selected employee and category.
Identify the employee labels, category headings, and numeric values in your source table. In the example below, employees are in A2:A32, categories are in B1:O1, and values are in B2:O32.
Sum matching matrix values with SUMPRODUCT
Use this formula when employee names label rows and categories such as overtime or vacation label columns.
SUMPRODUCT tests the row and column criteria, then sums the matching numeric cells. It includes all matching rows and columns if a label appears more than once.
Enter employee names in A37 and below, and category headings in B36 and across.
Select B37 and enter =SUMPRODUCT(($A$2:$A$32=$A37)*($B$1:$O$1=B$36)*$B$2:$O$32). Press Enter.
Drag the fill handle from B37 down and across the summary table. The formula keeps the source ranges fixed while changing the employee and category references.

Calculate matrix totals in WPS Spreadsheets
Use the same SUMPRODUCT approach in WPS Spreadsheets to summarize numeric values by employee and category.
- 1. Open the workbook: Open WPS Spreadsheets and select Open to choose your Excel workbook.
- 2. Arrange the criteria: Place employee names in A37 and below and category headings in B36 and across, or adjust the formula references to match your sheet.
- 3. Enter SUMPRODUCT: Select B37 and enter =SUMPRODUCT(($A$2:$A$32=$A37)*($B$1:$O$1=B$36)*$B$2:$O$32), then press Enter.
- 4. Copy the formula: Drag the fill handle down and across to calculate the remaining employee and category totals.

Frequently Asked Questions
Why does the formula use dollar signs in the references?
The dollar signs fix the source ranges when you fill the formula. In $A37, the employee column stays fixed; in B$36, the category heading row stays fixed.
What happens if an employee or category appears more than once?
SUMPRODUCT adds all numeric cells where the employee label and category heading both match, including matches in multiple rows or columns.
Why am I getting a #VALUE! error?
Check that the employee range has the same number of rows as the value matrix and that the heading range has the same number of columns. Also check B2:O32 for text or error values where numbers are expected.
Can I use this formula in WPS Spreadsheets?
Yes. Open the workbook in WPS Spreadsheets, enter the SUMPRODUCT formula in the first summary cell, and adjust the ranges to match your table.




