Function Problems

Use SUMPRODUCT to Sum by Category and Year in Spreadsheets

Kushani NimanthikaKushani Nimanthika Nov 10, 2026 869 views

Question details

The user needs to sum values for a specific cost category within a specific fiscal year across a two-dimensional data range where SUMIFS cannot be applied.

How to Use SUMPRODUCT to Sum by Category and Fiscal Year
Product
Spreadsheet
Device & OS
not provided
Scenario
Calculating conditional sums in a complex two-dimensional dataset containing category rows and date columns.
Observed behavior
SUMIFS cannot directly evaluate a 2D data range against mixed row and column criteria simultaneously, requiring an alternative formula to achieve the correct sum.
Before you start

Ensure your column headers contain valid date formats so the YEAR function can extract the correct fiscal year, and verify that your criteria and data ranges are perfectly aligned.

Solution 1Recommended

Use the SUMPRODUCT Function

SUMPRODUCT allows for array calculations that evaluate multiple conditions across rows and columns simultaneously, making it ideal for 2D data ranges.

The SUMPRODUCT function natively handles arrays without requiring special keystrokes. By multiplying boolean arrays (True/False converted to 1/0) with the data range, it filters out values that don't meet your criteria.

1
Select the target cell

Click on the cell where you want the total sum for the specific category and year to appear.

2
Input the SUMPRODUCT formula

Type the formula: =SUMPRODUCT((B3:B22="Design")*C3:CP22*(YEAR(C2:CP2)=2022)) and ensure the ranges match your actual dataset.

3
Calculate the result

Press Enter. The function will evaluate the row condition (Design) and column condition (2022) to return the correct sum.

Use the SUMPRODUCT Function
Formula Breakdown: The formula multiplies the category match array, the actual data range, and the year match array. Only cells meeting both the row and column criteria return a non-zero value to be summed.
Advanced Data Analysis

Master Complex Formulas with WPS Spreadsheet

WPS Spreadsheet fully supports advanced array formulas like SUMPRODUCT, SUMIFS, and dynamic arrays, making two-dimensional data analysis seamless and highly efficient.

  1. 1. Download and Install: Download WPS Office for free from the official website and install it on your device.
  2. 2. Open your workbook: Launch WPS Spreadsheet and open your existing .xlsx file containing the 2D dataset.
  3. 3. Apply the formula: Type =SUMPRODUCT into your target cell to trigger the formula assistant.
  4. 4. Calculate effortlessly: Input your row and column conditions exactly as you would in Excel to get your customized sum.
Fully compatible with Microsoft Excel formulas and functionsFree and lightweight alternative for complex data analysisBuilt-in intelligent formula suggestions and error checkingSeamless processing of large two-dimensional datasets
microsoft office alternative - wps office

Frequently Asked Questions

Why does my SUMPRODUCT formula return a #VALUE! error?

This typically happens if the ranges in your arrays do not have the same dimensions, or if text exists in a range where mathematical operations (like multiplication) are being applied.

Can I use SUMIFS instead of SUMPRODUCT for this task?

No, SUMIFS requires the sum range and criteria ranges to be of the exact same size and orientation (e.g., all columns or all rows). It cannot simultaneously cross-reference a row criteria with a column criteria over a 2D sum range.

How do I change the condition to a different category or year?

Simply replace "Design" with your desired category name (e.g., "Marketing") and 2022 with the target year in the formula: =SUMPRODUCT((B3:B22="Marketing")*C3:CP22*(YEAR(C2:CP2)=2023)).

Does WPS Spreadsheet support the YEAR function inside arrays?

Yes, WPS Spreadsheet fully supports the YEAR function within array formulas and SUMPRODUCT, just like Microsoft Excel, allowing you to seamlessly extract years from date headers.