+ Reply to Thread
Results 1 to 6 of 6

Calculating difference in time after midnight

  1. #1
    Registered User
    Join Date
    12-14-2013
    Location
    Swindon,England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Unhappy Calculating difference in time after midnight

    Hi Everyone; I'm hoping you can help me.
    I'm trying to calculate the available man hours I have for my shift/team. I have got the basic formula to deduct the time, and lost time for breaks ok, but when the shift end time crosses midnight the formula returns a "value" error message. i.e. start time = 18:00. End time = 24:00 breaks = 15 mins gives me a formula like this =TEXT(O17-N17-P17,"h:mm") and a result of 5:45
    Any ideas how I can make this formula work so it can calulate the variance even though the shift ends at 02:00am the following morning?
    Any thoughts gratefully received.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Calculating difference in time after midnight

    =MOD(O17-N17-P17, 1) and format as h:mm
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    12-14-2013
    Location
    Swindon,England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Calculating difference in time after midnight

    Excellent, thanks very much, that worked perfectly.
    The last part of the sum is to multiple the result from that formula by the number of people I have on shift. Keeping the format as h:mm means the result corrupts once it reaches 24:00. Is there a way of maintaining the integrity of your answer but allowing the result to SUM to give me a total number of hours available? (on average I have 20 people per shift.
    Thanks for the help

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Calculating difference in time after midnight

    Format as [h]:mm

  5. #5
    Registered User
    Join Date
    12-14-2013
    Location
    Swindon,England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Calculating difference in time after midnight

    Excellent. That works really well. I think I can build the rest of this tool now.
    My team and I thank you very much.
    Merry Christmas

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Calculating difference in time after midnight

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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. Calculating time difference over midnight!
    By sygazelle in forum Excel General
    Replies: 14
    Last Post: 05-28-2022, 04:20 PM
  2. formula to calculate time difference crossing midnight
    By ditorejax in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-06-2014, 08:27 PM
  3. Calculating time after midnight
    By ryangodammit in forum Excel General
    Replies: 5
    Last Post: 12-09-2008, 11:57 PM
  4. Calculating Time Past Midnight
    By Darren in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-13-2006, 11:03 AM
  5. Replies: 3
    Last Post: 01-17-2006, 01:55 PM

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