Excel Formula for average differences between different rows for the same ID

kenderweasel

New Member
Joined
Feb 17, 2017
Messages
40
Hi,

I have a spreadsheet which lists a customer ID, Chat Start Time, Chat End Time, and Date. I need a formula that will look up the chat end time of the first interaction with a particular customer ID, then work out the time difference between that and the chat start time of the next interaction with the same customer, and so on - resulting in a single figure for that customer that gives the average difference between the individual chats. I then need to return an average time between chats for all customers with a particular number of interactions on a particular date. I think I need an array formula, but I don't know where to start :(

Customer IDDateChat StartChat End
728/08/201812:0412:16
43228/08/201815:0815:12
4628/08/201802:1903:21
328/08/201807:5608:05
728/08/201816:5417:05
728/08/201813:0413:22
43228/08/201811:1712:05
4628/08/201809:1509:32
<colgroup><col width="127" style="width: 95pt; mso-width-source: userset; mso-width-alt: 4644;" span="2"> <col width="77" style="width: 58pt; mso-width-source: userset; mso-width-alt: 2816;"> <col width="75" style="width: 56pt; mso-width-source: userset; mso-width-alt: 2742;"> <tbody> </tbody>
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Can you use these? Note all the time values have been formatted as [h]:mm in Custom Formats;


Book1
ABCDE
1Customer IDDateChat StartChat End
24628-08-182:193:21
3328-08-187:568:05
44628-08-189:159:32
543228-08-1811:1712:05
6728-08-1812:0412:16
7728-08-1813:0413:22
843228-08-1815:0815:12
9728-08-1816:5417:05
10
11Customer IDAVG
1272:10
13
14Customer IDChat StartChat EndDIFFERENCE
15712:0412:160:48
16713:0413:223:32
17716:5417:05
18
19ALL CHATS0:22
20
21DateCustomer IDChat StartChat EndDIFFERENCE
2228-08-18462:193:211:02
2337:568:050:09
24469:159:320:17
2543211:1712:050:48
26712:0412:160:12
27713:0413:220:18
2843215:0815:120:04
29716:5417:050:11
Sheet1
Cell Formulas
RangeFormula
B12=AVERAGEIF($D$15:$D$17,"<>0")
B19=AVERAGEIF($E$22:$E$29,"<>0")
B15{=IFERROR(INDEX(C$2:C$9,SMALL(IF($A$2:$A$9=$A$12,ROW($A$2:$A$9)-ROW($A$2)+1),ROWS(A$15:A15))),"")}
B22{=IFERROR(INDEX($A$2:$A$9,SMALL(IF($B$2:$B$9=$A$22,ROW($B$2:$B$9)-ROW($B$2)+1),ROWS($B$22:B22))),"")}
D15=IFERROR(B16-C15,"")
D22{=IFERROR(INDEX($D$2:$D$9,SMALL(IF($B$2:$B$9=$A$22,ROW($B$2:$B$9)-ROW($B$2)+1),ROWS($B$22:B22))),"")}
E22=IFERROR(D22-C22,"")
A15{=IFERROR(INDEX($A$2:$A$9,SMALL(IF($A$2:$A$9=$A$12,ROW($A$2:$A$9)-ROW($A$2)+1),ROWS(A$15:A15))),"")}
C15{=IFERROR(INDEX(D$2:D$9,SMALL(IF($A$2:$A$9=$A$12,ROW($A$2:$A$9)-ROW($A$2)+1),ROWS(B$15:B15))),"")}
C22{=IFERROR(INDEX($C$2:$C$9,SMALL(IF($B$2:$B$9=$A$22,ROW($B$2:$B$9)-ROW($B$2)+1),ROWS($B$22:B22))),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

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