Sum All Matching Rows in Excel Instead of Using VLOOKUP
Question details
The user needs to add values from every row that matches a color or another criterion.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A spreadsheet contains repeated matches, and the user wants a total rather than a value from one matching row.
- Observed behavior
- VLOOKUP returns a value from the first matching row rather than adding values from all matching rows.
Identify the column containing the criteria and the column containing the numbers to add. The examples below assume colors are in A2:A100, numbers are in B2:B100, and an additional criterion is in C2:C100.
Use SUMIF to Add Values for One Criterion
Use SUMIF when you need to total all rows matching one color or other criterion.
Open the spreadsheet in Excel and click an empty cell where you want the total.
Type =SUMIF(A2:A100,"Green",B2:B100) and press Enter. Excel adds the numbers in column B for every row where column A is Green.
Edit the formula in the formula bar to use your actual ranges or a different criterion. You can also replace "Green" with a cell reference such as D2.

Use SUMIFS to Add Values for Multiple Criteria
Use SUMIFS when each row must meet more than one condition.
Sum Matching Rows with WPS Spreadsheets
Use SUMIF or SUMIFS in WPS Spreadsheets to add every value that meets your criteria, including in an Excel workbook.
- 1. Open your workbook: Open WPS Spreadsheets and select Open to choose your workbook.
- 2. Choose a result cell: Click an empty cell where you want the total to appear.
- 3. Enter a formula: Type =SUMIF(A2:A100,"Green",B2:B100) and press Enter. Replace the ranges and criterion with those in your worksheet.
- 4. Add more conditions if needed: For multiple criteria, enter a SUMIFS formula such as =SUMIFS(B2:B100,A2:A100,"Green",C2:C100,"<>Apple") in the result cell.

Frequently Asked Questions
Why doesn't VLOOKUP add all matching rows?
VLOOKUP returns a value from the first matching row. Use =SUMIF(A2:A100,"Green",B2:B100) to add values from every row that matches Green.
Can I use a cell reference instead of typing the color?
Yes. If D2 contains the color, enter =SUMIF(A2:A100,D2,B2:B100) in the result cell.
How do I sum rows that meet two conditions?
Use SUMIFS with a sum range followed by each criteria range and criterion. For example, =SUMIFS(B2:B100,A2:A100,"Green",C2:C100,"<>Apple") adds values for Green rows whose column C value is not Apple.
Can I use these formulas in WPS Spreadsheets?
Yes. Open the workbook in WPS Spreadsheets, select a result cell, and enter a SUMIF or SUMIFS formula using your worksheet ranges.




