sumproduct of unique instances only

doug firr

Board Regular
Joined
Mar 28, 2011
Messages
140
Picture 2 columns: Col A uniquepersonID | Col B dd/mm/yy |

There can be multiple instances of the same unique person ID - a person can appear in the data numerous times.

For each month of the year I would like to know the number of individuals who appear, not the number of total instances.

The formula =sumproduct((A2:A100>=1/1/12)*(sumproductA2:A100<2/1/12)) would give me the total instances but not unique instances.

How would I tell excel to return only to return unique people in each month, rather than the number of instances?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Picture 2 columns: Col A uniquepersonID | Col B dd/mm/yy |

There can be multiple instances of the same unique person ID - a person can appear in the data numerous times.

For each month of the year I would like to know the number of individuals who appear, not the number of total instances.

The formula =sumproduct((A2:A100>=1/1/12)*(sumproductA2:A100<2/1/12)) would give me the total instances but not unique instances.

How would I tell excel to return only to return unique people in each month, rather than the number of instances?

A formula approach would be:

C2: 1-Jan-12

D2, control+shift+enter, not just enter:
Rich (BB code):
=SUM(IF(FREQUENCY(IF($A$2:$A$100<>"",
   IF(ISNUMBER($B$2:$B$100),IF($B$2:$B$100-DAY(B$2:$B$100)+1=D2,
      MATCH("~"&$A$2:$A$100,$A$2:$A$100&"",0)))),
        ROW($A$2:$A$100)-ROW($A$2)+1),1))
 
Upvote 0
Picture 2 columns: Col A uniquepersonID | Col B dd/mm/yy |

There can be multiple instances of the same unique person ID - a person can appear in the data numerous times.

For each month of the year I would like to know the number of individuals who appear, not the number of total instances.

The formula =sumproduct((A2:A100>=1/1/12)*(sumproductA2:A100<2/1/12)) would give me the total instances but not unique instances.

How would I tell excel to return only to return unique people in each month, rather than the number of instances?
Try this...

Book1
ABCDE
1IDDate_MonthCount
231/30/2012_Jan1
362/1/2012_Feb2
462/3/2012_Mar2
582/25/2012_Apr3
613/24/2012_May0
763/24/2012_Jun0
844/8/2012_Jul2
924/24/2012_Aug1
1064/27/2012_Sep4
1117/13/2012_Oct0
1267/13/2012_Nov1
1367/19/2012_Dec1
1418/11/2012___
1579/1/2012___
1619/14/2012___
1759/23/2012___
1829/29/2012___
19711/29/2012___
20512/14/2012___
Sheet1

This array formula** entered in E2 and copied down:

=SUM(IF(FREQUENCY(IF(TEXT(B$2:B$20,"mmm")=D2,MATCH(A$2:A$20,A$2:A$20,0)),ROW(A$2:A$20)-ROW(A$2)),1))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.

I'm assuming the dates are all within the same year.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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