View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
JLatham JLatham is offline
external usenet poster
 
Posts: 3,365
Default vlookup & sum? or maybe summing dupes?

I see a couple of ways of doing this. Neither involves VLOOKUP :-).

VLOOKUP() will only find the first entry for the match request, so if an
account appears more than once in any list, it only finds the first one.

#1 - Look at using SUMIF(). You say "worksheets" with my emphasis on
worksheets, so I'm assuming that the sheets reside in the same workBOOK (.xls
file).
On a 3rd sheet you could use column A to enter account numbers into, perhaps
even a Validated Data list to pick from. Or entries for each account on
separate rows. No matter, but say your list/entry is in A2. Then in B2 you
could put a formula similar to this:
=SUMIF(Sheet1!A$1:A$150,A2,Sheet1!B$1:B$150)+SUMIF (Sheet2!A$1:A$555,A2,Sheet2!B$1:B$555)

That formula assumes that the list on Sheet1 goes from row 1 down to 150,
and on Sheet2 it extends from row 1 to row 555.

You could even rewrite it to not have to worry when the length of the lists
grow:
=SUMIF(Sheet1!A:A,A2,Sheet1!B:B)+SUMIF(Sheet2!A:A, A2,Sheet2!B:B)

That's 2, there's a third involving SUMPRODUCT() but I think that's overkill
in this situation.

Hope this helps with your solution.
"blswes" wrote:

I have two separate worksheets with lists of accounts. Some accounts are on
both worksheets, and some accounts exist only on one worksheet.

My goal is to create a third worksheet with a master list of accounts that
also sums the values of any accounts that appear on both worksheets.

Would this involve summing VLOOKUPs, or is there a quicker way of pasting
both lists onto the third worksheet and then summing dupes?