# Sumproduct based on multple conditions

#### Shamsuddeen

##### Active Member
Hi all!

I have a table with the following data:

Column A-Date Column B-Amount

01-Jan-2000 25000
12-Jan-2000 15000
18-Jan-2000 10000
20-Mar-2001 2500
25-Mar-2001 3000
01-Aug-2002 45000
02-Aug-2002 100
31-Aug-2003 650

and so on......

I would like to have the totat and count of amount per month as below:

Period Total Count
Jan-2000 xxxxx xx
Mar-2001 xxxxxx xx
Aug-2002 xxxxxx xx
Aug-2003 xxxxxx xx

Thanks for the help in advance.

Shamsuddeen

### Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

#### north19701

##### Active Member
it looks like a pivot table would be one option, and group your period my month and year.

#### Shamsuddeen

##### Active Member

My table contains more than 1000 rows and I need to preserve the original table as is and the total and count should appear at the bottom of the table with the sumproduct formula.

Shamsuddeen

##### MrExcel MVP
Shamsuddeen said:

My table contains more than 1000 rows and I need to preserve the original table as is and the total and count should appear at the bottom of the table with the sumproduct formula.

Shamsuddeen

I don't think that's a good reason, but lets have it as you wish...

=SUMPRODUCT(--(TEXT(DateRange,"m/yy")=TEXT(CritDate,"m/yy"),AmountRange)

which gives you the total wrt the month/year in CritDate.

=SUMPRODUCT(--(TEXT(DateRange,"m/yy")=TEXT(CritDate,"m/yy"),--ISNUMBER(AmountRange))

counts the amounts wrt CritDate.

#### north19701

##### Active Member
Book8
ABCDEFGH
101-Jan-200025000
212-Jan-200015000
318-Jan-200010000
420-Mar-20012500
525-Mar-20013000
601-Aug-200245000
702-Aug-2002100
831-Aug-2003650
9
10
11TotalCount
12Jan-00500003
13Mar-0155002
14Aug-02451002
15Aug-036501
16
17
18
19
20
Sheet3

Something like this?

the formula in b12 is:
=SUMPRODUCT((MONTH(\$A\$1:\$A\$8)=MONTH(\$A12))*(YEAR(\$A\$1:\$A\$8)=YEAR(\$A12)),\$B\$1:\$B\$8)

and c12 is:

=SUMPRODUCT((MONTH(\$A\$1:\$A\$8)=MONTH(\$A12))*(YEAR(\$A\$1:\$A\$8)=YEAR(\$A12)))

I really believe the pivot table would be much easier to manage, though.

#### Shamsuddeen

##### Active Member
Thanks for all the replies.

I will give a try.

Shamsuddeen

Replies
15
Views
206
Replies
3
Views
162
Replies
1
Views
285
Replies
3
Views
171
Replies
3
Views
1K

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,152,101
Messages
5,768,101
Members
425,453
Latest member
bince

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back