FormulaCraft

How to look up a value and sum the matches in Excel and Google Sheets

Topic:Lookups (any direction)
Excel & Google Sheets
=SUMIF(A2:A6,D2,B2:B6)

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Put your lookup key in a cell (e.g. D2).
  2. 2Enter =SUMIF(A2:A6,D2,B2:B6) in the result cell.
  3. 3The first argument (A2:A6) is the range to search; D2 is the criterion; B2:B6 is the range to sum.
  4. 4Press Enter. The formula returns the total of all B values where the A value matches D2.

Tips

Need it for your exact data?

Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.

Frequently asked

What is the difference between SUMIF and VLOOKUP for summing?

VLOOKUP returns the value from the first matching row. SUMIF adds up all matching rows, making it the right choice when there are multiple matches.

Can I sum across multiple sheets?

SUMIF does not natively sum across multiple sheets. Use a 3D reference with SUM or combine SUMIF with INDIRECT for a workaround.

More on Lookups (any direction)

See all →

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: