+ Reply to Thread
Results 1 to 11 of 11

Average of Times Spanning Midnight

  1. #1
    Registered User
    Join Date
    09-25-2015
    Location
    Toronto
    MS-Off Ver
    2010
    Posts
    29

    Average of Times Spanning Midnight

    Hi there,

    I have a simple formula which calculates a team's overall average (using their daily time finished)
    =AVERAGE(D8:AA8)

    However, one of the times from a certain day goes past midnight (Ex. 1:00AM) and this number improves the average and makes it seem earlier, when it should be in fact later.

    How do I solve this?

    Thanks!
    Attached Files Attached Files
    Last edited by LJenny; 11-23-2015 at 04:41 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,922

    Re: Average of Times Spanning Midnight

    (How to) Upload a Workbook directly to the Forum
    (please do not post pictures or links to worksheets)
    • Click Advanced (next to quick post),
    • Scroll down until you see "Manage Attachments",
    • Click that then select "add files" (top right corner).
    • Click "Select Files" find your file, click "open" click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Click "Done" at bottom right to close the Attachment Manager.
    • Click "Submit Reply"
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    09-25-2015
    Location
    Toronto
    MS-Off Ver
    2010
    Posts
    29

    Re: Average of Times Spanning Midnight

    Quote Originally Posted by protonLeah View Post
    (How to) Upload a Workbook directly to the Forum
    (please do not post pictures or links to worksheets)
    • Click Advanced (next to quick post),
    • Scroll down until you see "Manage Attachments",
    • Click that then select "add files" (top right corner).
    • Click "Select Files" find your file, click "open" click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Click "Done" at bottom right to close the Attachment Manager.
    • Click "Submit Reply"
    Okay I've included an attachment.

    So for Team E, the average calculation in Column AB is incorrect because the 1:47 time is actually making the average earlier instead of later.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Average of Times Spanning Midnight

    Hi,

    How should the system determine whether the time in question, e.g. 01:47 is indeed the next day and not the current day. Is there some starting time which could be used to determine whether atime before that means the next day? For instance the earliest time excluding 01:47 is 12:28. Does this imply there could be a rule that says a time less than say 12:00 means the following day?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Registered User
    Join Date
    09-25-2015
    Location
    Toronto
    MS-Off Ver
    2010
    Posts
    29

    Re: Average of Times Spanning Midnight

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    How should the system determine whether the time in question, e.g. 01:47 is indeed the next day and not the current day. Is there some starting time which could be used to determine whether atime before that means the next day? For instance the earliest time excluding 01:47 is 12:28. Does this imply there could be a rule that says a time less than say 12:00 means the following day?
    So anything before 6:00PM is the next day. Crap! Thanks for pointing out I have some 12:28 times in there too... I don't want to write dates on the times since it will make it harder to read for the user.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Average of Times Spanning Midnight

    Would you add examples of the results you expect to see on a few of the rows given the 6:00 PM rule you suggest so that we can see the end goal.

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,725

    Re: Average of Times Spanning Midnight

    What is the range of times that this can fall into each day? Say, for example, that the times for a given day fall between 7:00 PM and 2:00 AM the next morning. (19:00 to 02:00). I would add 12 hours to times earlier than noon, and take the average of that.

    This can be done with an array formula. Enter this formula into the cell
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    then instead of hitting ENTER, hit the combination CTRL-SHIFT-ENTER. If you have done it correctly you will see brackets around the formula in the formula bar.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    You cannot do this by typing the brackets; you must hit the combination CTRL-SHIFT-ENTER.

    (This assumes that times after midnight are rare. If by some quirk your average is later than midnight, then the result would be 12 hours later.)
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  8. #8
    Registered User
    Join Date
    09-25-2015
    Location
    Toronto
    MS-Off Ver
    2010
    Posts
    29

    Re: Average of Times Spanning Midnight

    Quote Originally Posted by Richard Buttrey View Post
    Would you add examples of the results you expect to see on a few of the rows given the 6:00 PM rule you suggest so that we can see the end goal.
    I would just like for Row 27 and Column AB to correctly display the average time for the team or day, such as "9:00 PM".

    Quote Originally Posted by 6StringJazzer View Post
    What is the range of times that this can fall into each day? Say, for example, that the times for a given day fall between 7:00 PM and 2:00 AM the next morning. (19:00 to 02:00). I would add 12 hours to times earlier than noon, and take the average of that.

    This can be done with an array formula. Enter this formula into the cell
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    then instead of hitting ENTER, hit the combination CTRL-SHIFT-ENTER. If you have done it correctly you will see brackets around the formula in the formula bar.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    You cannot do this by typing the brackets; you must hit the combination CTRL-SHIFT-ENTER.

    (This assumes that times after midnight are rare. If by some quirk your average is later than midnight, then the result would be 12 hours later.)
    Okay yeah like average times should be 6PM to 2AM. Why add 12 hours? Shouldn't it be 24?

    Also this formula is picking up on the blanks now, I tried:
    =AVERAGE(IF(AND(D7:AA7<0.5,D7:AA7<>0),D7:AA7+1,D7:AA7))
    But it appears not to be working :S
    Last edited by LJenny; 11-23-2015 at 05:18 PM.

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Average of Times Spanning Midnight

    Quote Originally Posted by LJenny View Post
    I would just like for Row 27 and Column AB to correctly display the average time for the team or day, such as "9:00 PM".
    The reason I asked you to manually calculate and enter in the workbook the average you expect to see for a few example rows is that experience tells us that this whole process of answering requests is much helped if we know the end goal. It save a lot of to-ing and fro-ing and misuderstanding. We can test our ideas knowing what the result should be.

    And incidentally there's no need to requote previous comments unless absolutely necessary for clarification.

  10. #10
    Registered User
    Join Date
    09-25-2015
    Location
    Toronto
    MS-Off Ver
    2010
    Posts
    29

    Re: Average of Times Spanning Midnight

    Sorry about that, I don't think I understood you properly the first time. I believe the correct time for Team E should be 21:40 while Team D should be 19:47. 6StringJazzer's idea worked great but I am unable to get the correct values for both teams to show under one formula since it picks up blanks.

  11. #11
    Registered User
    Join Date
    09-25-2015
    Location
    Toronto
    MS-Off Ver
    2010
    Posts
    29

    Re: Average of Times Spanning Midnight

    Hope I am allowed to bump!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 08-17-2022, 11:21 AM
  2. Counting the number of occurrences and spanning midnight
    By allwrighty in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-01-2013, 05:53 PM
  3. [SOLVED] Count occurrences and sum values with times spanning over midnight.
    By SorZer in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-14-2012, 04:12 AM
  4. Replies: 5
    Last Post: 06-15-2011, 06:52 AM
  5. Time spanning midnight ---- as minutes, not hh:mm
    By Hang Glider in forum Excel General
    Replies: 1
    Last Post: 01-24-2011, 06:07 PM
  6. Hours in gnatt spanning midnight
    By r1ch1nxdcc in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-15-2009, 10:22 AM
  7. Hours spanning midnight on gnatt (formula inc)
    By r1ch1nxdcc in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-15-2009, 09:48 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1