Share via

Calculating Sum of Time Differences and then the Average

Anonymous
2011-03-08T22:02:09+00:00
  1. I have succeeded in entering times into Excel without the colon, and have it show up as hh:mm, with the colon - Great!   (Method used was provided in this forum and is noted below.)

2)  I have also succeeded in calculating the difference between two entered times (e.g start and stop time) - Great!  (Method used was provided by the same person in this forum and is noted below.)

New  3)  Now I need to calculate the Sum of the above mentioned time differences.  Using normal SUM methods don't work

New 4)  And from the SUM in #3, I need to also calculate an average of these time differences. 

Any help is greatly appreciated as always.

Thanks, Jim   (SEE FOLLOWING)

Methods used to calculate #1 and #2 is shown below:

jghans wrote:

> I'm wanting to enter military time without the colon "hhmm"

> so it ends up as "hh:mm"

Format the cells as Custom 00:00 .

To do that, select the cells, right-click and click on Format Cells, Number, Custom, and enter 00:00 into the Type field.

Note that even though the military time 1234 might appear as 12:34, it is still the number one thousand thirty-four, not the numeric time 12:34.

jghans wrote:

> I also need to be able to subtract one "hhmm" entry from

> another "hhmm" entry so I can end up with the "hh:mm"

> difference with the colon.

If the start time is in A1 and the end time is in A2, use the following formula:

=TEXT(A2,"00:00")-TEXT(A1,"00:00")+(A1>A2)

formatted as Custom hh:mm .

This results in true numeric time.

The term (A1>A2) handles the case when the start time appears to exceed the end time because the time interval spans midnight.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2011-03-08T22:35:37+00:00

Summing the time differences should work, but you should format the cell with the sum formula with the custom format [h]:mm or [hh]:mm. The square brackets [ ] around h or hh specify that the time is cumulative time (which can be higher than 24 hours), not clock time.

Averaging should work too.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

Answer accepted by question author

Anonymous
2011-03-08T22:36:41+00:00

Jim wrote:

> 3)  Now I need to calculate the Sum of the above mentioned time

> differences.  Using normal SUM methods don't work

It should, if you are computing the intermediate differences in a cells.

Suppose that A1:A100 contains start times and B1:B100 contains corresponding end times.  Then put the following formula into C1 and copy down through C100:

=TEXT(B1,"00:00")-TEXT(A1,"00:00")+(A1>B1)

formatted as Custom hh:mm.

Then the sum is simply =SUM(C1:C100), and the average is simply =AVERAGE(C1:C100).

Both should be formatted as Custom [h]:mm because presumably the sum of the hours can exceed 23.

However, if you want to avoid computing the intermediate differences in column C, you could do this:

  1. Compute the sum using:

=SUMPRODUCT(TEXT(B1:B100,"00:00")-TEXT(A1:A100,"00:00")+(A1:A100>B1:B100))

formatted as Custom [h]:mm.

  1. Compute the average using on one of the following:

2a. If #1 is computed in C1, then =C1/100 or =C1/COUNT(C1:C100).

2b. If you would like to avoid the intermediate sum, use the following array formula  [*]:

=AVERAGE(TEXT(B1:B100,"00:00")-TEXT(A1:A100,"00:00")+(A1:A100>B1:B100))

In both cases, remember to format as Custom [h]:mm or [h]:mm:ss.

[*] Enter an array formula by pressing ctrl+shift+Enter instead of just Enter.  Excel will display an array formula surrounded by curly braces in the Formula Bar, i.e. {=formula}.  You cannot type the curly braces yourself.  If you make a mistake, select the cell, press F2 and edit if needed, then press ctrl+shift+Enter.

Was this answer helpful?

0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2011-03-09T15:42:13+00:00

    Great - You all do a super job!  Thanks so much.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2011-03-09T15:21:43+00:00

    Excellent!  -  Thanks Joe - Problem Solved!!  - - You guys are awesome.

    Was this answer helpful?

    0 comments No comments