Find how many agents worked how long on a call

cr2crf

New Member
Joined
Jun 19, 2013
Messages
40
Hello

I need to know how many agents worked on a call and for how long. The example below starts with column A and ends with F, rows 1 thru 6. The example is very simplified as there may be as many as 6 different agents helping on a call. Variables are, each time an agent logs into the call to add something the start time stays the same as when the call started but the end time changes to equal the time they ended their comment. When they make another comment, they get the same start time with a new end time. The total call duration equals the original call start time and the last end time noted by one of the agents.

If my life was a simple as the attached I could hand count this but I have 117 agents working 24/7 taking 1200 calls per day. Ugh!

Any help would be appreciated.

Thanks


AGENTCALL IDSTART DTSTART TMEND DTEND TM
JOE10101/1/201812:07:49AM1/1/20181:21:06AM
JOE10101/1/201812:07:49AM1/1/201812:07:52AM
BILL10101/1/201812:07:49AM1/1/201812:12:53AM
BILL10101/1/201812:07:49AM1/1/201812:30:03AM
ALLEN10101/1/201812:07:49AM1/1/201812:47:53AM

<tbody>
</tbody>
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
If I understand your requirement correctly, I think you can achieve it with a pivot table … You need to place a "space" between the time & AM or PM so excel can read the time correctly

Row LabelsCount of AGENTMin of START TMMax of END TM
1010 5.0012:07 AM1:21 AM
Grand Total 5.0012:07 AM1:21 AM

<tbody>
</tbody>
 
Last edited:
Upvote 0
Is there a formula that will separate the AM and PM? I have thousands of lines. To do it manually would take days./
 
Upvote 0
This is one way to do it ...


Book1
AB
1END TM
21:21:06PM1:21 PM
Sheet1
Cell Formulas
RangeFormula
B2=TIMEVALUE(IF(RIGHT(A2,2)="AM",SUBSTITUTE(A2,"AM"," AM"),SUBSTITUTE(A2,"PM"," PM")))
 
Upvote 0
That worked for the time, however in your example it counted five agents when there were only three. there has to be a formula that can do it. Anyone?
 
Upvote 0
If you are using excel 2013 or above, you can get distinct count in pivot table - Just check the following link
https://www.exceltrick.com/how_to/count-unique-values-excel/ … Scroll to the middle of the page to "Method 3"




Book1
ABCD
3Row LabelsDistinct Count of AGENTMin of START TMMax of END TM
410103.0012:07 AM1:21 AM
5Grand Total3.0012:07 AM1:21 AM
Sheet2
 
Upvote 0
That worked for the time, however in your example it counted five agents when there were only three. there has to be a formula that can do it. Anyone?


Here's a UDF formula to count based on your need, maybe not the best effecient way but it should do the job :)

ABCDEFG
1AGENTCALL IDSTART DTSTART TMEND DTEND TM# of Agents
2JOE101001-01-1812:07:49AM01-01-181:21:06AM3
3JOE101001-01-1812:07:49AM01-01-1812:07:52AM3
4BILL101001-01-1812:07:49AM01-01-1812:12:53AM3
5BILL101001-01-1812:07:49AM01-01-1812:30:03AM3
6ALLEN101001-01-1812:07:49AM01-01-1812:47:53AM3

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

Worksheet Formulas
CellFormula
G2=CountUnique($A$2:A6,$B$2:B6,B2)
G3=CountUnique($A$2:A7,$B$2:B7,B3)
G4=CountUnique($A$2:A8,$B$2:B8,B4)
G5=CountUnique($A$2:A9,$B$2:B9,B5)
G6=CountUnique($A$2:A10,$B$2:B10,B6)

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

<tbody>
</tbody>



Code:
Function CountUnique(Rg As Range, IDs_Rg As Range, ID As String) As Double

Dim Arr() As Variant
Arr = Union(Rg, IDs_Rg)

For x = LBound(Arr) To UBound(Arr)
    If Arr(x, 2) <> ID Then Arr(x, 1) = 0
Next x

Dim dict As Object
Set dict = CreateObject("Scripting.Dictionary")

For x = LBound(Arr) To UBound(Arr)
    If Arr(x, 1) <> 0 Then
        If Not dict.Exists(Arr(x, 1)) Then dict.Add key:=Arr(x, 1), Item:=0
    End If
Next x

CountUnique = dict.Count

End Function
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,896
Messages
6,122,132
Members
449,066
Latest member
Andyg666

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