How to Use Excel SUMIF to Total Values Matching a Code
Question details
Total values in column E only when the corresponding code in column B is 1026.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains codes in B8:B26 and corresponding values in E8:E26.
- Observed behavior
- The desired result is a total of the values in E8:E26 for rows where the code in B8:B26 equals 1026.
Check that the codes are in B8:B26 and their corresponding numeric values are in E8:E26. Confirm that B34 is available for the result.
Use SUMIF to Add Values for Code 1026
Enter one formula to sum only the rows whose code matches 1026.
In Excel, click cell B34.
Type =SUMIF(B8:B26,1026,E8:E26) into B34 and press Enter.
Review B34: Excel adds the values in E8:E26 only for rows where the corresponding cell in B8:B26 equals 1026.

Total Matching Codes with SUMIF in WPS Spreadsheet
Use the same SUMIF formula in WPS Spreadsheet to total values for code 1026, then continue working with your Excel-compatible workbook.
- 1. Open the workbook: Open WPS Spreadsheet and choose Open to select your workbook.
- 2. Select the result cell: Click cell B34, or another empty cell outside the data ranges.
- 3. Enter SUMIF: Type =SUMIF(B8:B26,1026,E8:E26) and press Enter.
- 4. Save the workbook: Choose File > Save to keep the formula in your workbook.

Frequently Asked Questions
What does each part of the SUMIF formula mean?
In =SUMIF(B8:B26,1026,E8:E26), B8:B26 is the code range, 1026 is the matching criterion, and E8:E26 contains the values to add.
Can I use a cell to specify the code instead of typing 1026?
Yes. If the code is in D2, enter =SUMIF(B8:B26,D2,E8:E26) in an empty result cell.
How do I include more rows in the total?
Edit the formula so both ranges cover the additional rows. For example, use =SUMIF(B8:B100,1026,E8:E100) to include rows 8 through 100.
Why does the formula return zero?
Check that B8:B26 contains the intended code and that the corresponding cells in E8:E26 contain numeric values. Also confirm that the formula references the correct rows.




