Function Problems

Sum Excel Matrix Values Matching Multiple Row and Column Headers

Natalie TaylorNatalie Taylor Dec 2, 2026 869 views

Question details

Sum values in an origin-and-destination matrix when row and column headers match criteria in separate ranges.

Sum Excel Matrix Values Matching Multiple Row and Column Headers
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet contains a matrix of values, row and column headers, and separate lists of criteria for each dimension.
Observed behavior
The desired result is a total of matrix cells at the intersections of matching row and column headers.
Before you start

Identify the matrix values, row headers, column headers, and the two criteria ranges. Make sure the headers align with the matrix and are not blank; adjust the example ranges if your worksheet uses different cells.

Solution 1Recommended

Use SUMPRODUCT and MATCH to sum the matching matrix cells

Use this formula when each result should include every matrix cell whose row and column headers appear in their respective criteria lists.

MATCH checks whether each header appears in its criteria range, and SUMPRODUCT sums the values where both checks are true.

1
Check the example ranges

In the worksheet, use B2:P16 for matrix values, A2:A16 for row headers, and B17:P17 for column headers. Place the row criteria in B21:N21 and the column criteria in O21:AA21.

2
Enter the formula

Select an empty result cell in row 21 and enter =SUMPRODUCT($B$2:$P$16,ISNUMBER(MATCH($B$17:$P$17,$O21:$AA21,0))*ISNUMBER(MATCH($A$2:$A$16,$B21:$N21,0))).

3
Fill down

Drag the result cell's fill handle down to calculate totals for the criteria lists in subsequent rows.

Use SUMPRODUCT and MATCH to sum the matching matrix cells
Range alignment: The row-header range must have the same number of rows as the matrix, and the column-header range must have the same number of columns. Replace the example references with your actual ranges.
Calculate matrix totals in WPS Spreadsheet

Sum matching matrix values in WPS Spreadsheet

Use SUMPRODUCT, MATCH, and ISNUMBER in WPS Spreadsheet to total matrix values for matching row and column criteria.

  1. 1. Open the workbook: Open WPS Spreadsheet and select Open to load your workbook.
  2. 2. Check the ranges: Locate the matrix, its row and column headers, and the two criteria lists. Adjust the example formula references to match your worksheet.
  3. 3. Enter the formula: Select an empty result cell and enter =SUMPRODUCT($B$2:$P$16,ISNUMBER(MATCH($B$17:$P$17,$O21:$AA21,0))*ISNUMBER(MATCH($A$2:$A$16,$B21:$N21,0))).
  4. 4. Calculate other totals: Drag the result cell's fill handle down for the remaining criteria rows, then use File > Save to save the workbook.
Sum intersections of multiple matching row and column headersOpen and save Microsoft Excel XLSX and XLS filesFill a formula down for multiple sets of criteriaWork in a familiar spreadsheet interface
microsoft office alternative - wps office

Frequently Asked Questions

What happens if a criterion appears more than once in a list?

MATCH checks whether a header appears in the list, so duplicate criteria do not count a matching matrix cell more than once.

Why does the formula return an error?

Check that the matrix dimensions match the row and column header ranges. Also check for errors in the source cells and use your Excel installation's formula argument separator if it differs from a comma.

Can I use the formula with a different matrix size?

Yes. Replace B2:P16, A2:A16, and B17:P17 with your matrix and header ranges. Keep the row and column counts aligned with the matrix.

Why are some expected values missing from the total?

Check that the headers match the entries in the criteria ranges and that the matrix cells contain numeric values. MATCH with 0 requires an exact match.