ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel macro/function like VLOOKUP that sums eventual multiple matches (https://www.excelbanter.com/excel-programming/362800-excel-macro-function-like-vlookup-sums-eventual-multiple-matches.html)

Mary[_10_]

Excel macro/function like VLOOKUP that sums eventual multiple matches
 
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 |



Ardus Petus

Excel macro/function like VLOOKUP that sums eventual multiple matches
 
=SUMIF(Sheet2!A1:A999,A1,Sheet2:B1:B999)

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

HTH
--
AP

"Mary" a écrit dans le message de news:
...
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 |





Jim Thomlinson

Excel macro/function like VLOOKUP that sums eventual multiple matc
 
Take a look at the sumproduct formula. Here is a link that explains it...

http://www.xldynamic.com/source/xld.SUMPRODUCT.html
--
HTH...

Jim Thomlinson


"Mary" wrote:

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 |





All times are GMT +1. The time now is 05:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com