sum based on 2 criteria within a table

H

herkimer

I am trying to do a SUMIF on a table, but I have multiple criteria in 2
columns.

The table is such that the name repeats several times, as there is another
column with account numbers in it, which in most cases also has multiple
lines. The last column holds dollar amounts.

I want to sum the dollar amounts for a specified name/account number
combination from the table. SUMIF appears to only work for one variable.

What function can I use to do this?

Thx
 
S

Sean Timmons

That would be SUMPRODUCT()

=SUMPRODUCT(--(A2:A1000="Bob"),--(B2:B1000=12345678),C2:C1000)

Couple of notes:

All three data sets must encompass the same number of rows.

You should not reference, say, A:A. SUMPRODUCT is not a fan of entire column
or row searches.

Of course, I hard coded names, but you'll probably want to enter, dsay, D2
instead of "Bob" and E2 instead of the account #.
 
S

ShaneDevenshire

Hi,

If you are using 2007 you can use SUMIFS

=SUMIFS(C1:C6,A1:A6,H1,B1:B6,I1)

In this example C1:C6 is the sum range, A1:A6 is criteria range 1 and H1 is
the first condition, B1:B6 is the second criteria range and I1 contains the
second condtions.

Regardless of which formula you use it is always a good idea to use
references in them rather than hard coding them if at all possible.

If this helps, please click the Yes button.
 
H

herkimer

Thank you very much, this is the first time I have used these discussion
groups...and I am overwhelmed and grateful. Works perfect.

Have a great day!
 
H

herkimer

Thank you very much, this is the first time I have used these discussion
groups...and I am overwhelmed and grateful. Works perfect.

Have a great day!
 
H

herkimer

Hi Mike H

This didn't do what I needed it to do; see the other responses to this
question...I don't understand the syntax with the dashes inside the brackets,
but it seems to work.

I checked the Help again after getting this guidance, I would never have
gotten this syntax or anything close from the formula help within Excel. In
fact the description of the function would not have made me even look at that
one.

Thanks again for your input
Have a great day
 
H

herkimer

Shane,

Thank you; this is very well explained. When I get Office 2007 I will keep
this in mind.

Have a great day!
 

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