Function Problems

How to Use Excel SUMIF to Total Values Matching a Code

Steve KSteve K Nov 18, 2026 869 views

Question details

Total values in column E only when the corresponding code in column B is 1026.

How to Total Values Matching a Code with Excel SUMIF
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.
Before you start

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.

Solution 1Recommended

Use SUMIF to Add Values for Code 1026

Enter one formula to sum only the rows whose code matches 1026.

1
Select the result cell

In Excel, click cell B34.

2
Enter the formula

Type =SUMIF(B8:B26,1026,E8:E26) into B34 and press Enter.

3
Check the result

Review B34: Excel adds the values in E8:E26 only for rows where the corresponding cell in B8:B26 equals 1026.

Use SUMIF to Add Values for Code 1026
Keep the ranges aligned: The criteria range and sum range should cover the same rows so that each code is matched to the correct value.
Work with spreadsheets in WPS Office

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. 1. Open the workbook: Open WPS Spreadsheet and choose Open to select your workbook.
  2. 2. Select the result cell: Click cell B34, or another empty cell outside the data ranges.
  3. 3. Enter SUMIF: Type =SUMIF(B8:B26,1026,E8:E26) and press Enter.
  4. 4. Save the workbook: Choose File > Save to keep the formula in your workbook.
Sum values for a matching code with SUMIFOpen and edit Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interfaceWork with a free office suite
microsoft office alternative - wps office

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.