+ Reply to Thread
Results 1 to 11 of 11

Differential Pay

  1. #1
    Registered User
    Join Date
    07-05-2012
    Location
    new york, new york
    MS-Off Ver
    Excel 2007
    Posts
    11

    Differential Pay

    Is there a formula that will calculate the number of hours worked between 8PM and 5AM? I need it for a time card.

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

    Re: Differential Pay

    =MOD(end_time-start_time,1) and format as required

  3. #3
    Registered User
    Join Date
    07-05-2012
    Location
    new york, new york
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Differential Pay

    Pepe,

    I tried what you suggested, but I don't seem to be able to get the correct answer. Maybe I'm not formatting it right. How/what do I need to format? On a side note, my in/out times are formatted with dates. I'm not sure but I think that makes a difference.

    Bob

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

    Re: Differential Pay

    TimeDiff.xlsxDoes the attached help? ( only works if less than 24 hrs apart)

  5. #5
    Registered User
    Join Date
    07-05-2012
    Location
    new york, new york
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Differential Pay

    Well that calculates the total number of hours between any two hours, but what I need it to do is calculate just between 8PM and 5AM

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

    Re: Differential Pay

    Well then replace the hours as needed !

  7. #7
    Registered User
    Join Date
    07-05-2012
    Location
    new york, new york
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Differential Pay

    I have two columns in my Excel file that contain the Start(C) and End(E) times, I was able to get the time difference between the 2 cells. Their cell format is dd/mm/yyyy 00:00 PM/AM.

    I need a formula that will calculate the number of hours worked during the night shift (between 8PM & 5AM), but I can't figure it out.

    For Example,

    Start Time (C12): 1/2/2012 3:00 AM
    End Time (E12): 1/2/2012 10:00 PM

    Night Differential should be 4 hours. 3:00AM -5:00AM is 2hours and 8:00PM-10:00PM is another 2 hours.

    Right now I have this formula.
    =MAX(0,MIN(E12,INT(C12)+1+"5:00")-MAX(C12,INT(C12)+"20:00"))
    However it only calculates the Night differential that comes from the back end of the shift. For example it can calculate the 2 hours that come from working 8:00PM-10:00PM, but not 3:00AM-5:00AM.

    Any help would be appreciated. Sorry if my prior wording of this issue wasn't great!

    Sincerely,
    Bob

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

    Re: Differential Pay

    Hello Bob, try this formula

    =E12-C12-(INT(E12)-INT(C12))*("20:00"-"5:00")+MEDIAN(MOD(C12,1),"5:00","20:00")-MEDIAN(MOD(E12,1),"5:00","20:00")
    Audere est facere

  9. #9
    Registered User
    Join Date
    07-05-2012
    Location
    new york, new york
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Differential Pay

    This is the formula I'm working with now. It removes one of the issues with the one I posted earlier.

    =IF(COUNT(C12,E12)<2,0,MAX(0,MIN(E12,INT(C12)+1+"5:00")-MAX(C12,INT(C12)+"20:00")))

  10. #10
    Registered User
    Join Date
    07-05-2012
    Location
    new york, new york
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Differential Pay

    Seems to be working perfectly!!! Thank you so much daddylonglegs! I really appreciate it.

    Bob

  11. #11
    Registered User
    Join Date
    12-05-2019
    Location
    Minneapolis, MN
    MS-Off Ver
    2013
    Posts
    1

    Re: Differential Pay

    Quote Originally Posted by daddylonglegs View Post
    Hello Bob, try this formula

    =E12-C12-(INT(E12)-INT(C12))*("20:00"-"5:00")+MEDIAN(MOD(C12,1),"5:00","20:00")-MEDIAN(MOD(E12,1),"5:00","20:00")
    This formula works great! I had asked the same question and kept getting the same answer not understanding what I was really asking before I stumbled upon this one.

    I know this is a really old thread, but just wondering if there's a way to make it work for an overnight shift?
    Last edited by kiwisoup; 03-10-2022 at 07:42 PM.

+ 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