Add up all numbers in VLOOKUP that has identical lookup value

  • Thread starter ssolomon via OfficeKB.com
  • Start date
S

ssolomon via OfficeKB.com

Maybe VLOOKUP is not the best function to use; but I want to pull ALL numbers
associated with a person's name and have them added to one cell.

Example:

A B C D
1 LName FName Dept Hours
2 Smith Brandon 2114 85
3 Smith Brandon 0277 110

The above shows what the data would look like on the sheet entitled JAN. I
want the data on another page, so the cell would contain all the hours that
Brandon Smith worked in one month. Not sure VLOOKUP is the correct solution.

Thanks for any help that can be provided.

Steve
 
T

T. Valko

Try this:

=SUMPRODUCT(--(Jan!A2:A10="Smith"),--(Jan!B2:B10="Brandon"),Jan!D2:D10)

Better if you use cells to hold the criteria:

A1 = Smith
B1 = Brandon

=SUMPRODUCT(--(Jan!A2:A10=A1),--(Jan!B2:B10=B1),Jan!D2:D10)
 
S

ssolomon via OfficeKB.com

Valko -

Thanks!! I was looking at the SUMIF in the help and was still having
problems. I put this in and it worked perfectly.

Thanks a bunch!!

Steve

T. Valko said:
Try this:

=SUMPRODUCT(--(Jan!A2:A10="Smith"),--(Jan!B2:B10="Brandon"),Jan!D2:D10)

Better if you use cells to hold the criteria:

A1 = Smith
B1 = Brandon

=SUMPRODUCT(--(Jan!A2:A10=A1),--(Jan!B2:B10=B1),Jan!D2:D10)
Maybe VLOOKUP is not the best function to use; but I want to pull ALL
numbers
[quoted text clipped - 17 lines]
 
T

T. Valko

If evey last name was unique (distinct) then you could use SUMIF:

=SUMIF(Jan!A2:A10,"Smith",Jan!D2:D10)

However, if you have:

Smith...Brandon
Smith...Joe

Then SUMIF will sum *every* Smith.

Thanks for the feedback!

--
Biff
Microsoft Excel MVP


ssolomon via OfficeKB.com said:
Valko -

Thanks!! I was looking at the SUMIF in the help and was still having
problems. I put this in and it worked perfectly.

Thanks a bunch!!

Steve

T. Valko said:
Try this:

=SUMPRODUCT(--(Jan!A2:A10="Smith"),--(Jan!B2:B10="Brandon"),Jan!D2:D10)

Better if you use cells to hold the criteria:

A1 = Smith
B1 = Brandon

=SUMPRODUCT(--(Jan!A2:A10=A1),--(Jan!B2:B10=B1),Jan!D2:D10)
Maybe VLOOKUP is not the best function to use; but I want to pull ALL
numbers
[quoted text clipped - 17 lines]
 

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

Top