Need forumla for sum of duplicate occurance

sanjyou

New Member
Joined
Nov 14, 2018
Messages
15
Need formula to "sum number of duplicate occurance between two dates with one criteria ".
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I setup the following test table:

CD
21/1/20181
31/31/20180
43/2/20180
54/1/20180
65/1/20180
75/31/20181
8
9Criterion1
10Count2

<tbody>
</tbody>

In cell C10 I have the following array formula (requiring the CTRL+SHIFT+ENTER key stroke):

Code:
{ =SUM(IF(D2:D7=D9,1,0)) }

As you can see, it correctly sums the number of duplicate values.

Now, this only works if your data is sorted by date and you're going to select the ranges to calculate. If you want to specify the date ranges and the criterion in separate cells and total the dupes, then here is the approach I took (others might have a more elegant solution):

AB
11/1/181
21/31/180
33/2/180
44/1/181
55/1/180
65/31/180
7
8Start Date1/1/18
9End Date4/1/18
10Criterion1
11
12Count2

<tbody>
</tbody>

The formula in cell B12 is:

Code:
{ =SUMPRODUCT(IF(A1:A6>=B11,1,0),IF(A1:A6<=B12,1,0),IF(B1:B6=B8,1,0)) }

Again, this is an array formula so it requires the CSE keystroke. Also, this is a lot more intuitive if you use range names, E.g., :

Code:
 {=SUMPRODUCT(IF(Date>=StartDate,1,0),IF(Date<=EndDate,1,0),IF(CriterionColumn=Criterion,1,0)) }
 
Last edited:
Upvote 0
Here is a more elegant version of the second formula I posted:

Code:
 { =SUMPRODUCT(--(A1:A6>=B11),--(A1:A6<=B12),--(B1:B6=B8)) }
 
Upvote 0
[1]

{ =SUM(IF(D2:D7=D9,1,0)) }

>>

=COUNTIFS(D2:D7,D9)


[2]

{ =SUMPRODUCT(IF(A1:A6>=B11,1,0),IF(A1:A6<=B12,1,0),IF(B1:B6=B8,1,0)) }

>>

=COUNTIFS(A1:A6,">="&B11,A1:A6,"<="&B12,B1:B6,B8)


[3]

{=SUMPRODUCT(IF(Date>=StartDate,1,0),IF(Date<=EndDate,1,0),IF(CriterionColumn=Criterion,1,0)) }

>>

=COUNTIFS(Date,">="&StartDate,Date,"<="&EndDate,CriterionColumn,Criterion)


[4]

{ =SUMPRODUCT(--(A1:A6>=B11),--(A1:A6<=B12),--(B1:B6=B8)) }

>>

See COUNTIFS of [2].
 
Upvote 0

Forum statistics

Threads
1,216,031
Messages
6,128,424
Members
449,450
Latest member
gunars

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top