+ Reply to Thread
Results 1 to 7 of 7

Calculating working shifts between two hours

Hybrid View

  1. #1
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,033

    Calculating working shifts between two hours

    Break point between Day shift and Night shift is defined as 6/24 hours

    Need result in case that there are two breaking points: 6/24 and 22/24
    Meaning that Night shift is between 22:00 and 6:00

    I've tried to shift everything for 2 hours (6:00-> 8:00 and 22:00-> 24:00) to get one breaking point so above example could work.
    Same thing I get if I take 6 hours...

    But still missing something…

    Does anybody have some clue...
    Attached Files Attached Files
    Last edited by zbor; 05-09-2012 at 09:59 AM.
    Never use Merged Cells in Excel

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculating working shifts between two hours

    Perhaps:

    E6:
    =24*IF(B6<=C6;MIN("22:00";$C6)-MAX("06:00";$B6);MAX(0;"22:00"-MAX("06:00";$B6))+MAX(0;MIN("22:00";$C6)-"06:00"))
    
    F6:
    =24*D6-E6
    copied down
    dll will have far more succinct offerings than the above if you search for them.

    (should add: the above is designed to cater for the likes of 16:00 -> 15:30 - where day shift spans two days [16:00-22:00 + 06:00-15:30])
    Last edited by DonkeyOte; 12-20-2010 at 06:09 AM.

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,033

    Re: Calculating working shifts between two hours

    Hmm, I was also trying for MIN, MAX but always failed if both are less than 6:00 or something like that...

    Similliar as here for working from 1:00 to 2:00...

    what's dll?

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Calculating working shifts between two hours

    Quote Originally Posted by zbor
    I was also trying for MIN, MAX but always failed if both are less than 6:00 or something like that...
    encase within a MAX

    =24*IF(B6<=C6;MAX(0,MIN("22:00";$C6)-MAX("06:00";$B6));MAX(0;"22:00"-MAX("06:00";$B6))+MAX(0;MIN("22:00";$C6)-"06:00"))
    Quote Originally Posted by zbor
    what's dll?
    daddylonglegs - the best date time function wizard on the planet (IMO)

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,033

    Re: Calculating working shifts between two hours

    I think it's working now...

    Thx DO...

    I'll also ask ddl to see his opinion

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,696

    Re: Calculating working shifts between two hours

    I use this version

    =((B6>C6)*MEDIAN(0,C6-1/4,2/3)+MAX(0,MIN(11/12,C6+(B6>C6))-MAX(1/4,B6)))*24

    That will give you hours between 06:00 (1/4) and 22:00 (11/12). 2/3 represents the duration of the day shift (11/12-1/4)
    Audere est facere

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,033

    Re: Calculating working shifts between two hours

    That's did the trick... Thanks both.

+ 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