Sum Multiple Ranges by One Criterion in Excel
Question details
Calculate a total for an item number that may appear in several columns, counting the corresponding value for every occurrence.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Item numbers appear in multiple columns, while each row has a value to add when the item matches.
- Observed behavior
- The desired total includes the row value once for each matching occurrence, even when an item appears more than once in the same row.
Identify the cells containing item numbers, the row values to sum, and the cell containing the target item number. Make sure the item-number range and value range cover the same rows.
Use SUMPRODUCT to Count Matches Across Columns
Use one formula when the item numbers are in a contiguous block of columns.
This formula compares every cell in the item-number block with the criterion and adds the corresponding row value for each match. If an item appears twice in one row, that row's value is added twice.
Place row values in A2:A8, item numbers in B2:H8, and the item number to find in N2.
Select an empty result cell, enter =SUMPRODUCT(($B$2:$H$8=N2)*$A$2:$A$8), and press Enter.
In the formula bar, replace the example ranges and criterion cell with your own. Keep the first and last rows of the item and value ranges aligned.

Add SUMIF Results for Each Item-Number Column
Use separate SUMIF expressions when the columns are separate or you prefer to specify each range individually.
Sum Item Matches Across Columns in WPS Spreadsheets
Use SUMIF in WPS Spreadsheets to add the row value for each matching item number across multiple columns.
- 1. Open the workbook: In WPS Spreadsheets, open your workbook and locate the item-number columns and their corresponding row values.
- 2. Enter the criterion: Type the item number to find in a cell such as J3.
- 3. Enter the SUMIF formula: Select an empty cell and enter =SUMIF($B$2:$B$7,J3,$A$2:$A$7)+SUMIF($C$2:$C$7,J3,$A$2:$A$7), then press Enter.
- 4. Add other ranges: In the formula bar, add another +SUMIF expression for each additional item-number column, using the same row-value range.

Frequently Asked Questions
Does SUMPRODUCT count an item twice if it appears twice in one row?
Yes. In =SUMPRODUCT(($B$2:$H$8=N2)*$A$2:$A$8), each matching cell contributes the value from column A, so two matches in the same row contribute that value twice.
How do I add another column to the SUMIF formula?
In the formula bar, append another expression such as +SUMIF($D$2:$D$7,J3,$A$2:$A$7). Use the same criterion and sum range, and change the criterion range to the new column.
Why must the item and value ranges cover the same rows?
The formula needs to pair each item cell with its corresponding row value. For example, use B2:H8 with A2:A8, rather than ranges that start or end on different rows.
Can I use these formulas in WPS Spreadsheets?
Yes. In WPS Spreadsheets, enter the SUMIF expressions in an empty cell and add one expression for each item-number column. Adjust the cell references to match your worksheet.




