+ Reply to Thread
Results 1 to 10 of 10

Need to calculate night shift hours

  1. #1
    Registered User
    Join Date
    08-21-2012
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    5

    Need to calculate night shift hours

    Firstly thanx to all who try to help.

    My problem is thus:

    We get paid at a different rate for night work than daytime work. Night hours are 23:00 to 7:00. However, sometimes I start early and finish late, but only the time between those hours get the higher rate. Is there a formula to calculate this?

    Eg 1- I work from 22:57 until 7:08 - my night hours are 8 (the max)
    Eg 2- I work from 23:05 until 7:00 - my night hours are 7:55
    Eg 3- I work from 23:00 until 6:55 - my work hours are 7:55 etc

    (Btw, I need it for google docs, plus going past midnight I solved already )

    This is part one. Part two is overtime depending on whether it is during the day or night. But I'll post that once the first problem is sloved

  2. #2
    Registered User
    Join Date
    03-22-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Need to calculate night shift hours

    Hi, Please find the attached files to get your answer... i hope this will solve your problem...
    Attached Files Attached Files

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,447

    Re: Need to calculate night shift hours

    Perhaps use a Google docs forum. XL solutions might not be applicable

  4. #4
    Registered User
    Join Date
    08-21-2012
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    5

    Thumbs up Re: Need to calculate night shift hours

    Quote Originally Posted by nath_rk01 View Post
    Hi, Please find the attached files to get your answer... i hope this will solve your problem...
    It looks great. But it only works if there is some night shift involved. What I really need is a way that the result will be blank if the entry and exit are both during the daytime. Also I have an entry at 20:50 and exit at 23:35 which is giving me a result of 2:35 (same as total hours) and not 0:35 which is the correct amount???

    Thanx again for your help. At lest now I have a direction on the problem.

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Need to calculate night shift hours

    Try this formula

    =MOD(C3-B3,1)-(C3<B3)*2/3-MEDIAN(MOD(C3,1),"7:00"+0,"23:00"+0)+MEDIAN(MOD(B3,1),"7:00"+0,"23:00"+0)

    format result cell in time format

    This formula should work OK in both excel and google docs
    Audere est facere

  6. #6
    Registered User
    Join Date
    08-21-2012
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    5

    Wink Re: Need to calculate night shift hours

    Quote Originally Posted by Pepe Le Mokko View Post
    Perhaps use a Google docs forum. XL solutions might not be applicable
    I'm a noob here - sorry. You can move it if you want or tell me how to please.
    Last edited by avdald; 08-23-2012 at 09:40 AM.

  7. #7
    Registered User
    Join Date
    03-22-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Need to calculate night shift hours

    Good One... thanks daddylonglegs...

    @ avdald... you should try this one.. will give you the result exactly what you want...

  8. #8
    Registered User
    Join Date
    08-21-2012
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    5

    Thumbs up Re: Need to calculate night shift hours

    daddylonglegs - looking at other posts for a possible solution I had a feeling you would have the answer!

    When last were you told that you're a genius? Let me make that right now! YOU"RE A GENIUS

    Thanx a million.

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Need to calculate night shift hours

    @ avdald

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  10. #10
    Registered User
    Join Date
    08-21-2012
    Location
    Israel
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Need to calculate night shift hours

    I'm sorry - I'm still a noob here. But hopefully won't be for long. I still don't see how to mark a thread as solved. Btw, I was going to do some more testing before deciding that it really was solved.

    I have starred and approved the 2 guys who helped me. They both deserve it!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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