Merging to formulas

alanhather

New Member
Joined
Feb 2, 2018
Messages
24
Hi,

Im trying to count all the people in on total people column and then trying to count them again but using there ID. But if it comes up twice to count it as 1 in a date range.

Im using a Raw data download of about 4000 records and trying to stay away from an array formula that does work but, it slows down my computer.

here is an example of what im doing.


Raw Data Sample

[TABLE="width: 362"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]ID[/TD]
[TD]Name[/TD]
[TD]Date[/TD]
[/TR]
[TR]
[TD]A1223B[/TD]
[TD]John[/TD]
[TD="align: right"]01/01/2017[/TD]
[/TR]
[TR]
[TD]B112W[/TD]
[TD]David[/TD]
[TD="align: right"]01/02/2017[/TD]
[/TR]
[TR]
[TD]A586FD[/TD]
[TD]Kim[/TD]
[TD="align: right"]02/02/2017[/TD]
[/TR]
[TR]
[TD]7854S[/TD]
[TD]Daniel[/TD]
[TD="align: right"]03/02/2017[/TD]
[/TR]
[TR]
[TD]14541S[/TD]
[TD]Cara[/TD]
[TD="align: right"]04/02/2017[/TD]
[/TR]
[TR]
[TD]A1223B[/TD]
[TD]John[/TD]
[TD="align: right"]01/01/2017[/TD]
[/TR]
[TR]
[TD]9S5SJKS[/TD]
[TD]David[/TD]
[TD="align: right"]01/04/2017[/TD]
[/TR]
[TR]
[TD]S45S41S[/TD]
[TD]Kim[/TD]
[TD="align: right"]02/04/2017[/TD]
[/TR]
[TR]
[TD]S44558S[/TD]
[TD]Daniel[/TD]
[TD="align: right"]03/04/2017[/TD]
[/TR]
[TR]
[TD]A1233A[/TD]
[TD]Cara[/TD]
[TD="align: right"]01/01/2017[/TD]
[/TR]
[TR]
[TD]A1223A[/TD]
[TD]John[/TD]
[TD="align: right"]01/01/2017[/TD]
[/TR]
[TR]
[TD]8S745S2[/TD]
[TD]David[/TD]
[TD="align: right"]02/01/2017[/TD]
[/TR]
[TR]
[TD]S55S5SS[/TD]
[TD]Richard[/TD]
[TD="align: right"]03/01/2017[/TD]
[/TR]
[TR]
[TD]58S74SS[/TD]
[TD]Daniel[/TD]
[TD="align: right"]04/01/2017[/TD]
[/TR]
[TR]
[TD]A1233A[/TD]
[TD]Cara[/TD]
[TD="align: right"]01/01/2017
[/TD]
[/TR]
</tbody>[/TABLE]


Result Table

[TABLE="width: 251"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Dates[/TD]
[TD="align: right"]01/01/2017[/TD]
[TD="align: right"]31/01/2017[/TD]
[/TR]
[TR]
[TD]Name[/TD]
[TD]Total People[/TD]
[TD]Total ID[/TD]
[/TR]
[TR]
[TD]John[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]David[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Kim[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD]Daniel[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Cara[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]

Total People Column =COUNTIFS($C$2:$C$16,">="&$F$1,$C$2:$C$16,"<="&$G$1,$B$2:$B$16,E3)

Total ID =SUMPRODUCT(--($C$2:$C$16>=$F$1),--($C$2:$C$16<=$G$1),--($B$2:$B$16=E3),--1/COUNTIF($A$2:$A$16,$A$2:$A$16))

When I use the sum product formula on the big raw data sheet it returns a value of 0. Cant see what is going wrong.

here is a copy of the array formula im using now to achieve this.

=SUM(--(FREQUENCY(IF('Raw Data Prev Year'!$B:$B<>"",IF('Raw Data Prev Year'!$D:$D=A36,IF('Raw Data Prev Year'!S:S>=$B$50,IF('Raw Data Prev Year'!$S:$S<=$C$50,MATCH('Raw Data Prev Year'!$B:$B,'Raw Data Prev Year'!$B:$B,0))))),ROW('Raw Data Prev Year'!$B:$B)-ROW('Raw Data Prev Year'!$B$1)+1)>0))

Many thanks for the help.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,223,894
Messages
6,175,250
Members
452,623
Latest member
Techenthusiast

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