Function Problems

Sum All Matching Rows in Excel Instead of Using VLOOKUP

Steve KSteve K Dec 2, 2026 869 views

Question details

The user needs to add values from every row that matches a color or another criterion.

Sum All Matching Rows in Excel Instead of Using VLOOKUP
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.
Before you start

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.

Solution 1Recommended

Use SUMIF to Add Values for One Criterion

Use SUMIF when you need to total all rows matching one color or other criterion.

1
Select the result cell

Open the spreadsheet in Excel and click an empty cell where you want the total.

2
Enter the SUMIF formula

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.

3
Adjust the ranges or criterion

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 SUMIF to Add Values for One Criterion
Match the ranges: Use corresponding ranges of the same size so each criterion is checked against the correct value.
Sum matching rows in WPS

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. 1. Open your workbook: Open WPS Spreadsheets and select Open to choose your workbook.
  2. 2. Choose a result cell: Click an empty cell where you want the total to appear.
  3. 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. 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.
Add all matching rows with SUMIF or SUMIFSOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet formulas and a formula barWork with a free spreadsheet editor
microsoft office alternative - wps office

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.