View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joeu2004[_2_] joeu2004[_2_] is offline
external usenet poster
 
Posts: 829
Default Averaging times that cross midnight?

"Smurfy" wrote:
I keep track of what times I complete various task at work.
These times could be before or after midnight
I would like to do an average but i don't know how.
any ideas? or maybe I should just forget it on times.....


You don't provide sufficient details for us to offer a concrete solution. I
can only offer some concepts.

The easiest thing to do is: keep track of the date and time in each cell.
For example, instead of recording just 11:00 PM and 1:00 AM, record
5/30/2012 11:00 PM and 5/31/2012 1:00 AM. If they are recorded in A1 and
B1, the time difference is easy to compute:

=B1-A1

formatted as Time or as Custom [h]:mm if the difference might be greater
than 24 hours.

Note: You can also format A1 and B1 with to display just Time, if you like.

Alternatively, if A1 and B1 contain just time, you might compute the
difference using:

=B1-A1+(B1<A1)

However, that works only if the difference between A1 and B1 is less than 24
hours.

As for the average, simply use the AVERAGE function with a range of cells
that contain the time differences.

Alternatively, if A1:A10 contains start times and B1:B10 contains end times,
use the following array-entered formula (press ctrl+shift+Enter instead of
just Enter):

=AVERAGE(B1:B10-A1:A10)

or

=AVERAGE(B1:B10-A1:A10+(B1:B10<A1:A10))

depending on whether dates are included.