Function Problems

Use Excel SUMPRODUCT to Sum a Matrix by Row and Column Criteria

Steven ParkerSteven Parker Dec 2, 2026 869 views

Question details

Calculate totals in a matrix when both an employee row label and a column heading must match specified criteria.

Sum a Matrix by Row and Column Criteria with Excel SUMPRODUCT
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.
Before you start

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.

Solution 1Recommended

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.

1
Set up the summary table

Enter employee names in A37 and below, and category headings in B36 and across.

2
Enter the formula

Select B37 and enter =SUMPRODUCT(($A$2:$A$32=$A37)*($B$1:$O$1=B$36)*$B$2:$O$32). Press Enter.

3
Fill the results

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.

Sum matching matrix values with SUMPRODUCT
Use numeric values: The value matrix should contain numbers or blank cells. A formula that compares cells to text without multiplying by the numeric value range counts matches rather than summing their values.
WPS Spreadsheets

Calculate matrix totals in WPS Spreadsheets

Use the same SUMPRODUCT approach in WPS Spreadsheets to summarize numeric values by employee and category.

  1. 1. Open the workbook: Open WPS Spreadsheets and select Open to choose your Excel workbook.
  2. 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. 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. 4. Copy the formula: Drag the fill handle down and across to calculate the remaining employee and category totals.
Sum values using both row and column criteriaOpen and edit Microsoft Excel XLSX and XLS filesFill formulas across a summary tableWork in a familiar spreadsheet interface
microsoft office alternative - wps office

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.