Distinct Count based on two criteria (time involved)

honestabe1982

New Member
Joined
Aug 30, 2017
Messages
3
Please see the spreadsheet below. I've tried multiple array formulas with combination of sum/sumproduct/if/countif and no luck. I am trying to count the number of distinct ANI's that have a call time of greater than 0:00:29 and are of the campaign, Inbound - Live TV5.

I've been at this for hours using examples from other posts and no luck so far.

Please help.

Thanks!


TIMESTAMPANICALL TIMECAMPAIGN
Mon, 28 Aug 2017 12:04:1020145158240:08:40Inbound - Double Verified 4
Mon, 28 Aug 2017 09:16:4920226268400:00:10Inbound - Live TV4
Mon, 28 Aug 2017 12:32:2920227654470:01:28Inbound - Live TV4
Mon, 28 Aug 2017 19:05:5120247608120:00:09Inbound - Live TV4
Tue, 29 Aug 2017 15:41:0220256217750:05:13Inbound - Internet Lead
Tue, 29 Aug 2017 13:06:0820282952191:03:57Inbound - Double Verified 4
Mon, 28 Aug 2017 12:32:3720555246850:01:19Inbound - Live TV4
Mon, 28 Aug 2017 11:33:1520629407720:01:53Inbound - Live TV4
Mon, 28 Aug 2017 12:33:1620648782450:13:12Inbound - Live TV4
Tue, 29 Aug 2017 11:52:2320666417241:09:33Inbound - Live TV4
Tue, 29 Aug 2017 17:47:5320920222650:00:05Inbound - Live TV5
Mon, 28 Aug 2017 16:38:4520931261430:01:32Inbound - Internet Lead
Tue, 29 Aug 2017 12:47:2520934574700:16:44Inbound - Live TV4
Tue, 29 Aug 2017 13:56:0520956728471:44:50Inbound - Live TV4
Tue, 29 Aug 2017 13:13:3720972855170:02:59Inbound - Live TV4
Tue, 29 Aug 2017 12:53:1520982691640:15:18Inbound - Live TV5
Tue, 29 Aug 2017 17:48:5920982923910:00:37Inbound - Live TV5
Tue, 29 Aug 2017 17:55:1820982923910:00:22Inbound - Live TV5
Mon, 28 Aug 2017 13:25:0720982988320:04:54Inbound - Live TV4
Tue, 29 Aug 2017 16:33:0321030703961:36:38Inbound - Live TV4
Mon, 28 Aug 2017 13:21:2321031530531:22:14Inbound - Live TV5
Mon, 28 Aug 2017 11:34:4021033329781:18:00Inbound - Live TV4
Tue, 29 Aug 2017 16:15:4021038662120:01:17Inbound - Live TV4
Mon, 28 Aug 2017 16:57:1621041018340:02:55Inbound - Live TV4

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>



<colgroup><col><col><col><col></colgroup><tbody>
</tbody>
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Please see the spreadsheet below. I've tried multiple array formulas with combination of sum/sumproduct/if/countif and no luck. I am trying to count the number of distinct ANI's that have a call time of greater than 0:00:29 and are of the campaign, Inbound - Live TV5.

I've been at this for hours using examples from other posts and no luck so far.

Please help.

Thanks!


TIMESTAMPANICALL TIMECAMPAIGN
Mon, 28 Aug 2017 12:04:1020145158240:08:40Inbound - Double Verified 4
Mon, 28 Aug 2017 09:16:4920226268400:00:10Inbound - Live TV4
Mon, 28 Aug 2017 12:32:2920227654470:01:28Inbound - Live TV4
Mon, 28 Aug 2017 19:05:5120247608120:00:09Inbound - Live TV4
Tue, 29 Aug 2017 15:41:0220256217750:05:13Inbound - Internet Lead
Tue, 29 Aug 2017 13:06:0820282952191:03:57Inbound - Double Verified 4
Mon, 28 Aug 2017 12:32:3720555246850:01:19Inbound - Live TV4
Mon, 28 Aug 2017 11:33:1520629407720:01:53Inbound - Live TV4
Mon, 28 Aug 2017 12:33:1620648782450:13:12Inbound - Live TV4
Tue, 29 Aug 2017 11:52:2320666417241:09:33Inbound - Live TV4
Tue, 29 Aug 2017 17:47:5320920222650:00:05Inbound - Live TV5
Mon, 28 Aug 2017 16:38:4520931261430:01:32Inbound - Internet Lead
Tue, 29 Aug 2017 12:47:2520934574700:16:44Inbound - Live TV4
Tue, 29 Aug 2017 13:56:0520956728471:44:50Inbound - Live TV4
Tue, 29 Aug 2017 13:13:3720972855170:02:59Inbound - Live TV4
Tue, 29 Aug 2017 12:53:1520982691640:15:18Inbound - Live TV5
Tue, 29 Aug 2017 17:48:5920982923910:00:37Inbound - Live TV5
Tue, 29 Aug 2017 17:55:1820982923910:00:22Inbound - Live TV5
Mon, 28 Aug 2017 13:25:0720982988320:04:54Inbound - Live TV4
Tue, 29 Aug 2017 16:33:0321030703961:36:38Inbound - Live TV4
Mon, 28 Aug 2017 13:21:2321031530531:22:14Inbound - Live TV5
Mon, 28 Aug 2017 11:34:4021033329781:18:00Inbound - Live TV4
Tue, 29 Aug 2017 16:15:4021038662120:01:17Inbound - Live TV4
Mon, 28 Aug 2017 16:57:1621041018340:02:55Inbound - Live TV4

<tbody>
</tbody>



<tbody>
</tbody>

I couldn't do it without helper columns.. if you're okay with that, then see below:

E2=AND(C2>29/24/60/60,D2="Inbound - Live TV5")
F2=IF(E2,B2,"")

distinct count:
=SUM(IF(($E$2:$E$25)*(MATCH($F$2:$F$25,$F$2:$F$25,0)=ROW($F$2:$F$25)-1),1,0)) press CTRL+SHIFT+ENTER
 
Upvote 0
I couldn't do it without helper columns.. if you're okay with that, then see below:

E2=AND(C2>29/24/60/60,D2="Inbound - Live TV5")
F2=IF(E2,B2,"")

distinct count:
=SUM(IF(($E$2:$E$25)*(MATCH($F$2:$F$25,$F$2:$F$25,0)=ROW($F$2:$F$25)-1),1,0)) press CTRL+SHIFT+ENTER


First of all, thank you for taking the time to reply. While this looks like it would work for Live TV5, I would prefer a way to do it without if possible. The reason being is I need to do it for all the different campaigns, not just Live TV5. So, I'm looking for about 10 different cells to contain formulas that look to this sheet and check for greater than a certain amount of time (varies by campaign), look for the specific campaign and then kick back the distinct count of phone numbers according to those two criteria.

Seems like that would get a bit messy to do the proposed above for that many different variables.

Thoughts?
 
Upvote 0
Hi, honestabe1982!

Try:


Book1
ABCDEFGHIJ
1TIMESTAMPANICALL TIMECAMPAIGNCount -->4CAMPAIGNDISTINCT COUNT
2Mon, 28 Aug 2017 12:04:1020145158240:08:40Inbound - Double Verified 4Greater than -->0:00:29Inbound - Double Verified 42
3Mon, 28 Aug 2017 09:16:4920226268400:00:10Inbound - Live TV4Inbound - Live TV413
4Mon, 28 Aug 2017 12:32:2920227654470:01:28Inbound - Live TV4Inbound - Internet Lead2
5Mon, 28 Aug 2017 19:05:5120247608120:00:09Inbound - Live TV4Inbound - Live TV53
6Tue, 29 Aug 2017 15:41:0220256217750:05:13Inbound - Internet Lead
7Tue, 29 Aug 2017 13:06:0820282952191:03:57Inbound - Double Verified 4
8Mon, 28 Aug 2017 12:32:3720555246850:01:19Inbound - Live TV4
9Mon, 28 Aug 2017 11:33:1520629407720:01:53Inbound - Live TV4
10Mon, 28 Aug 2017 12:33:1620648782450:13:12Inbound - Live TV4
11Tue, 29 Aug 2017 11:52:2320666417241:09:33Inbound - Live TV4
12Tue, 29 Aug 2017 17:47:5320920222650:00:05Inbound - Live TV5
13Mon, 28 Aug 2017 16:38:4520931261430:01:32Inbound - Internet Lead
14Tue, 29 Aug 2017 12:47:2520934574700:16:44Inbound - Live TV4
15Tue, 29 Aug 2017 13:56:0520956728471:44:50Inbound - Live TV4
16Tue, 29 Aug 2017 13:13:3720972855170:02:59Inbound - Live TV4
17Tue, 29 Aug 2017 12:53:1520982691640:15:18Inbound - Live TV5
18Tue, 29 Aug 2017 17:48:5920982923910:00:37Inbound - Live TV5
19Tue, 29 Aug 2017 17:55:1820982923910:00:22Inbound - Live TV5
20Mon, 28 Aug 2017 13:25:0720982988320:04:54Inbound - Live TV4
21Tue, 29 Aug 2017 16:33:0321030703961:36:38Inbound - Live TV4
22Mon, 28 Aug 2017 13:21:2321031530531:22:14Inbound - Live TV5
23Mon, 28 Aug 2017 11:34:4021033329781:18:00Inbound - Live TV4
24Tue, 29 Aug 2017 16:15:4021038662120:01:17Inbound - Live TV4
25Mon, 28 Aug 2017 16:57:1621041018340:02:55Inbound - Live TV4
Hoja1
Cell Formulas
RangeFormula
G1=SUM(N(FREQUENCY(MATCH(D$2:D$25,D$2:D$25,),ROW(D$2:D$25)-ROW(D$1))>0))
I2=IF(ROWS(I$2:I2)>G$1,"",INDEX(D$2:D$25,MATCH(,INDEX(COUNTIF(I$1:I1,D$2:D$25),),)))
J2{=IF(I2="","",SUM(N(FREQUENCY(IF(C$2:C$25>G$2,IF(D$2:D$25=I2,MATCH(B$2:B$25,B$2:B$25,))),ROW(B$2:B$25)-ROW(B$1))>0)))}
Press CTRL+SHIFT+ENTER to enter array formulas.


Blessings!
 
Last edited:
Upvote 0
Hi, honestabe1982!

Try:

ABCDEFGHIJ
1TIMESTAMPANICALL TIMECAMPAIGNCount -->4CAMPAIGNDISTINCT COUNT
2Mon, 28 Aug 2017 12:04:1020145158240:08:40Inbound - Double Verified 4Greater than -->0:00:29Inbound - Double Verified 42
3Mon, 28 Aug 2017 09:16:4920226268400:00:10Inbound - Live TV4Inbound - Live TV413
4Mon, 28 Aug 2017 12:32:2920227654470:01:28Inbound - Live TV4Inbound - Internet Lead2
5Mon, 28 Aug 2017 19:05:5120247608120:00:09Inbound - Live TV4Inbound - Live TV53
6Tue, 29 Aug 2017 15:41:0220256217750:05:13Inbound - Internet Lead
7Tue, 29 Aug 2017 13:06:0820282952191:03:57Inbound - Double Verified 4
8Mon, 28 Aug 2017 12:32:3720555246850:01:19Inbound - Live TV4
9Mon, 28 Aug 2017 11:33:1520629407720:01:53Inbound - Live TV4
10Mon, 28 Aug 2017 12:33:1620648782450:13:12Inbound - Live TV4
11Tue, 29 Aug 2017 11:52:2320666417241:09:33Inbound - Live TV4
12Tue, 29 Aug 2017 17:47:5320920222650:00:05Inbound - Live TV5
13Mon, 28 Aug 2017 16:38:4520931261430:01:32Inbound - Internet Lead
14Tue, 29 Aug 2017 12:47:2520934574700:16:44Inbound - Live TV4
15Tue, 29 Aug 2017 13:56:0520956728471:44:50Inbound - Live TV4
16Tue, 29 Aug 2017 13:13:3720972855170:02:59Inbound - Live TV4
17Tue, 29 Aug 2017 12:53:1520982691640:15:18Inbound - Live TV5
18Tue, 29 Aug 2017 17:48:5920982923910:00:37Inbound - Live TV5
19Tue, 29 Aug 2017 17:55:1820982923910:00:22Inbound - Live TV5
20Mon, 28 Aug 2017 13:25:0720982988320:04:54Inbound - Live TV4
21Tue, 29 Aug 2017 16:33:0321030703961:36:38Inbound - Live TV4
22Mon, 28 Aug 2017 13:21:2321031530531:22:14Inbound - Live TV5
23Mon, 28 Aug 2017 11:34:4021033329781:18:00Inbound - Live TV4
24Tue, 29 Aug 2017 16:15:4021038662120:01:17Inbound - Live TV4
25Mon, 28 Aug 2017 16:57:1621041018340:02:55Inbound - Live TV4

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

Worksheet Formulas
CellFormula
G1=SUM(N(FREQUENCY(MATCH(D$2:D$25,D$2:D$25,),ROW(D$2:D$25)-ROW(D$1))>0))
I2=IF(ROWS(I$2:I2)>G$1,"",INDEX(D$2:D$25,MATCH(,INDEX(COUNTIF(I$1:I1,D$2:D$25),),)))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
J2{=IF(I2="","",SUM(N(FREQUENCY(IF(C$2:C$25>G$2,IF(D$2:D$25=I2,MATCH(B$2:B$25,B$2:B$25,))),ROW(B$2:B$25)-ROW(B$1))>0)))}

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



Blessings!



This worked for me. Thank you for your help!!

Blessings right back at cha!
 
Upvote 0
This is a case where, while you can use Pivot Tables, the method must be specific. When using data from an OLAP source or from the Data Model, you have a Distinct Count option for Values.
For this data set, its actually applying the filter to Call Time that presents more issue. Excel likes filtering Dates (automatically) rather than time. Except for this anomaly, I think setting up the Pivot Table is easier.
 
Upvote 0

Forum statistics

Threads
1,214,839
Messages
6,121,892
Members
449,058
Latest member
Guy Boot

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