+ Reply to Thread
Results 1 to 4 of 4

Shifts Hours

  1. #1
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Shifts Hours

    Hi,
    In the attached WB - the formula, in Col. "D", seems to be too long - although returning the expected result.
    Could somebody lighten my eyes with a much shorter formula ?
    Thanks, Elm
    Attached Files Attached Files
    Last edited by ElmerS; 02-20-2010 at 10:28 AM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Working Hours

    doesnt look to long to me!
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

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

    Re: Shifts Hours

    Depending on the type of shift you might have I think your current formula might miscalculate in some circumstances, e.g. if it's possible to have a shift 06:00 to 22:00 then presumably that should be 2:00 of nights (the first hour and the last hour) but your formula returns 1:00

    I normally calculate the day hours with a longer formula so I'd use this formula in C2 copied down to calculate those

    =(A2>B2)*MEDIAN(0,B2-J$3,J$2-J$3)+MAX(0,MIN(J$2,B2+(A2>B2))-MAX(J$3,A2))

    and then just get the rest in D2 with

    =E2-C2

  4. #4
    Forum Contributor
    Join Date
    11-28-2008
    Location
    Reykjavík, Iceland
    MS-Off Ver
    Any of: 2003 & 2007
    Posts
    412

    Re: Shifts Hours

    Woooooooowww...

    This is what I've been waiting for.

    Saving 37% of a formulas length simplifies it for the average user.

    Thank you so much, Elm

+ 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