How to Sum Rows Based on a Specific Column Condition in Excel
Question details
Calculate the total across a two-dimensional range for rows where a specific column's cell matches a given condition without writing manual formulas for every row.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Working with dynamic data across multiple columns and needing to automatically identify and sum rows based on a specific criteria.
- Observed behavior
- Needs a scalable formula solution to evaluate a condition across a target column and sum the corresponding row values.
Ensure your data is organized in a clear, tabular format with consistent columns, and identify the exact column that contains the condition you want to test.
Use SUMPRODUCT to Sum Rows Based on a Single Column
Use the SUMPRODUCT function to multiply a boolean array (the condition) by the numeric array, resulting in the sum of only the matching rows.
The SUMPRODUCT function is ideal for evaluating conditions without requiring Ctrl+Shift+Enter array formulas. It processes the criteria check and the summation natively.
Determine your condition column (e.g., A2:A6) and your numeric values range (e.g., B2:K6) in your spreadsheet.
In your result cell, type =SUMPRODUCT((A2:A6="D")*B2:K6). Replace "D" with your specific text or numeric condition.
Press Enter to calculate. The formula will evaluate which rows in A2:A6 equal 'D' and sum all corresponding row values in the B2:K6 range.

Use SUMPRODUCT and MMULT for Multi-Column Conditions
If the condition you are looking for might appear in multiple columns rather than a single specific column, combine SUMPRODUCT with MMULT.
Calculate Conditional Sums Instantly in WPS Office
WPS Spreadsheet offers full support for advanced array formulas, including SUMPRODUCT and MMULT, making it incredibly easy to perform complex conditional row sums. With a familiar interface and comprehensive function library, you can manage and analyze your data seamlessly.
- 1. Open your worksheet in WPS Spreadsheet: Launch WPS Office and open your Excel spreadsheet containing the data.
- 2. Enter the SUMPRODUCT formula: Select a blank cell and type the formula =SUMPRODUCT((A2:A6="D")*B2:K6) matching your data ranges.
- 3. Get your results: Press Enter to instantly see the calculated sum across the rows meeting your condition.

Frequently Asked Questions
Why is my SUMPRODUCT formula returning a #VALUE! error?
This usually happens if the criteria range (e.g., A2:A6) and the sum range (e.g., B2:K6) do not have the same number of rows. Ensure that the row dimensions of both ranges match exactly. It can also occur if there is text in the numerical sum range.
Can I use multiple conditions in SUMPRODUCT?
Yes, you can add more conditions by multiplying them together. For example, =SUMPRODUCT((A2:A6="D")*(C2:C6="Yes")*B2:K6) will sum the rows where column A is 'D' and column C is 'Yes'.
Can I reference a cell instead of hardcoding the condition "D"?
Absolutely. Instead of typing "D" directly into the formula, you can reference a cell like M1. The formula becomes =SUMPRODUCT((A2:A6=M1)*B2:K6), which makes it much easier to change criteria dynamically.
Does SUMPRODUCT require me to press Ctrl+Shift+Enter?
No, SUMPRODUCT is designed to handle arrays natively. You can simply press Enter after typing the formula, unlike older array formulas that required Ctrl+Shift+Enter.




