Counting distinct combo of multiple values within date range

excellenthelp

New Member
Joined
Mar 25, 2016
Messages
2
I've been stuck on this for a while now and would great appreciate any input you may have on this. I have a table with two values, Region and 'Start Date'. What I would like to do is get a count of all distinct combinations within a specified date range. I have 2 tables below, one to show an example of my data and another to show what I'm expecting from my output table.

Central1/31/16
Central1/31/16
Central3/15/16
Central2/1/16
Central3/15/16

<tbody>
</tbody>


RegionS_DateE_dateCount (What I'm solving for)
Central1/30/163/1/162
Central3/2/164/2/161

<tbody>
</tbody>

I have already have a formula for counting all occurrences where column A has 'Central' and the date in column B falls within a date range, but am having difficulty adapting this to only include exact matches once.

Code:
=COUNTIFS('Active + Archive'!S:S,'Data Summaries'!A12,'Active + Archive'!V:V,">="&B52,'Active + Archive'!V:V,"<="&D52)

S:S = my column for region denoting the criteria range to check
A12 = The value being checked in the range, in this case it's Central
V:V = The start date, date that I want to ensure is within the range
B52 = First date in the range I want to check
D52 = Last date in the range I want to check

I'm not sure if I need frequency, sumproduct, arrays, or what. From reading other posts I cobbled the below code together, but that's giving me decimals which can't be correct.

Code:
=SUMPRODUCT(IF(('Active + Archive'!V:V<=D52)*('Active + Archive'!V:V>=B52), 1/COUNTIFS('Active + Archive'!V:V, "<="&D52, 'Active + Archive'!V:V, ">="&D52, 'Active + Archive'!S:S, A52), 0))

Any insight you might be able to provide would be extremely appreciated, I'm suspecting that whatever I'm missing should be a quick fix (or at least that's what I'm hoping)!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
See if this works for you:

ABCD
1Central1/31/2016
2Central1/31/2016
3Central3/15/2016
4Central2/1/2016
5Central3/15/2016
6
7
8
9RegionS_DateE_dateCount
10Central1/30/20163/1/20162
11Central3/2/20164/2/20161
12

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet4

Array Formulas
CellFormula
D10{=SUM(IF(FREQUENCY(IF(($B$1:$B$5>=$B10)*($B$1:$B$5<=$C10)*($A$1:$A$5=$A10),$B$1:$B$5),$B$1:$B$5),1))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0
See if this works for you:

ABCD
1Central1/31/2016
2Central1/31/2016
3Central3/15/2016
4Central2/1/2016
5Central3/15/2016
6
7
8
9RegionS_DateE_dateCount
10Central1/30/20163/1/20162
11Central3/2/20164/2/20161
12

<tbody>
</tbody>
Sheet4

Array Formulas
CellFormula
D10{=SUM(IF(FREQUENCY(IF(($B$1:$B$5>=$B10)*($B$1:$B$5<=$C10)*($A$1:$A$5=$A10),$B$1:$B$5),$B$1:$B$5),1))}

<tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>


Just ran through some testing and that did the trick, thanks so much for your help!
 
Upvote 0

Forum statistics

Threads
1,216,094
Messages
6,128,785
Members
449,468
Latest member
AGreen17

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