Excel macro/function like VLOOKUP that sums eventual multiple matches

  • Thread starter Thread starter Mary
  • Start date Start date
M

Mary

How can I create an Excel command (macro or function) that works like the
VLOOKUP function but sums eventual multiple matches?

Example:

Sheet1 - before execution:
DOG | WHITE
HOUSE | YELLOW
CAT | GRAY

Sheet2 - before execution:
HOUSE | 300
DOG | 780
DOG | 200
BALL | 560

Sheet1 - AFTER execution:
DOG | WHITE | 980
HOUSE | YELLOW | 300
CAT | GRAY |
 
=SUMIF(Sheet2!A1:A999,A1,Sheet2:B1:B999)

This formula is to be coded in Sheet1, cell C1.
Then copied down

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top