Sum of Time Based on Criteria

Maddy1234

New Member
Joined
Mar 9, 2018
Messages
24
Hi experts,

Another problem with my last data set. I have the following data set where the users take part in 4 exercises.

Time StartedTime Ended
Exercise 119:0020:00
Exercise 220:0021:00
Exercise 321:0022:00
Exercise 122:0023:00
Exercise 423:000:00
Exercise 20:001:00
Exercise 31:002:00
Exercise 12:003:00
Exercise 43:004:00
Exercise 34:005:00
Exercise 25:006:00

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

The result I need is as follows.

Total Time
Exercise 13:00:00
Exercise 23:00:00
Exercise 33:00:00
Exercise 42:00:00

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

I tried to achieve this result by adding a helper column to the data set and getting the time differences and then doing a SUMIF in the Total Time column. It works for smaller data sets but not for larger sets of data. Hence Im looking for a solution without the use of a helper column.

I only need help with the column "Total Time".

Many thanks.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Maybe...

A
B
C
D
E
F
G
1
Time Started​
Time Ended​
Total Time​
Total (decimal)
2
Exercise 1​
19:00​
20:00​
Exercise 1​
03:00​
3​
3
Exercise 2​
20:00​
21:00​
Exercise 2​
03:00​
3​
4
Exercise 3​
21:00​
22:00​
Exercise 3​
03:00​
3​
5
Exercise 1​
22:00​
23:00​
Exercise 4​
02:00​
2​
6
Exercise 4​
23:00​
00:00​
7
Exercise 2​
00:00​
01:00​
8
Exercise 3​
01:00​
02:00​
9
Exercise 1​
02:00​
03:00​
10
Exercise 4​
03:00​
04:00​
11
Exercise 3​
04:00​
05:00​
12
Exercise 2​
05:00​
06:00​

<tbody>
</tbody>


Formula in F2 copied down
=SUMPRODUCT(--(A$2:A$12=E2),MOD(C$2:C$12-B$2:B$12,1))

Format F2:F6: Custom [hh]:mm

or to get the total as decimal value
Formula in G2 copied down
=SUMPRODUCT(--(A$2:A$12=E2),MOD(C$2:C$12-B$2:B$12,1))*24

M.
 
Last edited:
Upvote 0
Thanks Marcelo. Works like a charm.

Maybe...

A
B
C
D
E
F
G
1
Time Started​
Time Ended​
Total Time​
Total (decimal)
2
Exercise 1​
19:00​
20:00​
Exercise 1​
03:00​
3​
3
Exercise 2​
20:00​
21:00​
Exercise 2​
03:00​
3​
4
Exercise 3​
21:00​
22:00​
Exercise 3​
03:00​
3​
5
Exercise 1​
22:00​
23:00​
Exercise 4​
02:00​
2​
6
Exercise 4​
23:00​
00:00​
7
Exercise 2​
00:00​
01:00​
8
Exercise 3​
01:00​
02:00​
9
Exercise 1​
02:00​
03:00​
10
Exercise 4​
03:00​
04:00​
11
Exercise 3​
04:00​
05:00​
12
Exercise 2​
05:00​
06:00​

<tbody>
</tbody>


Formula in F2 copied down
=SUMPRODUCT(--(A$2:A$12=E2),MOD(C$2:C$12-B$2:B$12,1))

Format F2:F6: Custom [hh]:mm

or to get the total as decimal value
Formula in G2 copied down
=SUMPRODUCT(--(A$2:A$12=E2),MOD(C$2:C$12-B$2:B$12,1))*24

M.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,473
Messages
6,130,838
Members
449,597
Latest member
buikhanhsang

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