+ Reply to Thread
Results 1 to 10 of 10

Night Shift Differential

  1. #1
    Registered User
    Join Date
    04-12-2016
    Location
    minot
    MS-Off Ver
    2010
    Posts
    9

    Night Shift Differential

    I have a spreadsheet that needs to be able to calculate the Night Shift Differential of 10pm (22:00) start, 6am (6:00) end.

    I have converted this from our time clock software into a .PDF and then into an Excel document and it has an odd format that I can't figure out how to format properly to do use the formula.

    A1 = "5:52 pm" exactly like that without the quotations.
    B1 = "12:33 am"
    A2 = "1:08 am"
    B2 = "6:29 am"

    So far, my cells are setup as follows:
    Column B = In punch time
    Column K = Out punch time
    Column P = My attempts in converting the in punch time to military (24 hours)
    Column Q = My attempts in converting the out punch time to military (24 hours)
    Column R = Night Shift Differential start time, 10pm (22:00)
    Column S = Night Shift Differential End time, 6am (06:00)
    Column U = My attempt at doing the formula for calculating the Night Shift Differential

    Formula Example.jpg

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Night Shift Differential

    The formula in your other thread does what you want.

    http://www.excelforum.com/excel-gene...ate-cells.html

    Data Range
    A
    B
    C
    1
    Shift Start
    Shift End
    2
    22:00
    6:00
    3
    4
    5
    In
    Out
    Total
    6
    5:52 PM
    12:33 AM
    2:33
    7
    1:08 AM
    6:29 AM
    4:52
    8


    Formula entered in C6:

    =IF(AND(A6<>"",B6<>""),IF(A6<B6,MAX(MIN(2,B6)-MAX(A$2,A6),0)+MAX(MIN(B$2,B6)-MAX(0,A6),0),MAX(MIN(1.25,B6+1)-MAX(A$2,A6),0)+MAX((B$2-A6),0)),"")

    Format as h:mm

    Copy down as needed.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Contributor Toonies's Avatar
    Join Date
    07-30-2009
    Location
    Newcastle, UK
    MS-Off Ver
    Excel 2016
    Posts
    503

    Re: Night Shift Differential

    hi try this I think its another of Tony Valko great formula's
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    04-12-2016
    Location
    minot
    MS-Off Ver
    2010
    Posts
    9

    Re: Night Shift Differential

    Quote Originally Posted by Tony Valko View Post
    The formula in your other thread does what you want.

    http://www.excelforum.com/excel-gene...ate-cells.html

    Data Range
    A
    B
    C
    1
    Shift Start
    Shift End
    2
    22:00
    6:00
    3
    4
    5
    In
    Out
    Total
    6
    5:52 PM
    12:33 AM
    2:33
    7
    1:08 AM
    6:29 AM
    4:52
    8


    Formula entered in C6:

    =IF(AND(A6<>"",B6<>""),IF(A6<B6,MAX(MIN(2,B6)-MAX(A$2,A6),0)+MAX(MIN(B$2,B6)-MAX(0,A6),0),MAX(MIN(1.25,B6+1)-MAX(A$2,A6),0)+MAX((B$2-A6),0)),"")

    Format as h:mm

    Copy down as needed.
    That formula does not work for me. I created an entirely new spreadsheet with just that exact information, even in the same exact cells, and it doesn't come out correctly. I need to get rid of the 8:00.

    Incorrect.jpg
    Last edited by vaium; 04-15-2016 at 09:24 AM.

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Night Shift Differential

    Post a SMALL sample file and show us what results you expect.

    20 rows worth of data is plenty.

  6. #6
    Registered User
    Join Date
    04-12-2016
    Location
    minot
    MS-Off Ver
    2010
    Posts
    9

    Re: Night Shift Differential

    See attached.
    Attached Files Attached Files

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Night Shift Differential

    OK, your time values are not true time values. They're TEXT values that look like time values.

    Here's what I did to convert them into true time values...

    First, I unmerged the cells in column B.

    I selected the range B6:B25
    Goto the Data tab>Text to Columns
    Click Finish

    Do the same thing for the range K6:25

    That will sometimes convert TEXT numbers (time values) into numeric numbers. It worked in this case.

    Then, I put the formula in L6 and copied down to L25.

    The results are identical to those you entered in column M.

    I made a slight tweak to the formula wrt testing for empty cells:

    =IF(COUNT(B6,K6)<2,"",IF(B6<K6,MAX(MIN(2,K6)-MAX(A$2,B6),0)+MAX(MIN(B$2,K6)-MAX(0,B6),0),MAX(MIN(1.25,K6+1)-MAX(A$2,B6),0)+MAX((B$2-B6),0)))

    Here's your file with this implemented.
    Attached Files Attached Files
    Last edited by Tony Valko; 04-15-2016 at 10:32 AM.

  8. #8
    Registered User
    Join Date
    04-12-2016
    Location
    minot
    MS-Off Ver
    2010
    Posts
    9

    Re: Night Shift Differential

    I think this will work. Sorry for the frustration, Tony, it didn't occur to me that the times were showing up as text values. Had I known that this would've been much easier >_>. I feel blonde lol.

    The format in which the time card gets posted is a little wonky because of PDF -> Excel so I think I'll have to move a couple other things. When we have to alter a time punch it puts a little "E" in the same cell as the time (4:45 am E).

    I believe this should be sufficient for me to complete payroll at a much faster pace than before.

    Thank you,

  9. #9
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Night Shift Differential

    I broke the problem down into separate parts: Total time, Regular Hours, Night Hours. I also entered the start time of regular hours 6:00 AM and the End of regular hours 10:00 PM in cells S2 and U2.
    For Total Hours: Enter this in F2 and fill down. (choose whatever column you want for your actual data)
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    For Reg Hours: Enter this in G2 and fill down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    For Night hours: Enter this in H2 and fill down
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Night Shift Differential

    You're welcome. Thanks for the feedback!

+ 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. [SOLVED] How to count hours for Night Differential (using IF function)
    By helpme10 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 03-30-2019, 05:07 PM
  2. Computing for number of hours under Night Differential
    By emanon132501 in forum Excel General
    Replies: 4
    Last Post: 09-24-2015, 02:13 AM
  3. [SOLVED] Compute Night Differential Hours
    By UnKnown_25 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 08-04-2015, 11:17 AM
  4. TIME DIFFERENCE - Calculate Night Differential
    By persnickety in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-12-2013, 12:44 PM
  5. How to calculate Night Differential
    By mar_t in forum Excel General
    Replies: 10
    Last Post: 01-04-2013, 01:55 AM
  6. Replies: 4
    Last Post: 09-21-2012, 12:58 AM
  7. Replies: 2
    Last Post: 07-27-2012, 04:54 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