+ Reply to Thread
Results 1 to 5 of 5

Show each hour worked in shift over midnight

  1. #1
    Registered User
    Join Date
    12-29-2015
    Location
    Telford, England
    MS-Off Ver
    2010
    Posts
    5

    Show each hour worked in shift over midnight

    I want to return "1" for each hour worked in a shift. I can get this to work before midnight:
    Shift Start Time A2
    Shift Finish Time B2
    Times 6:00 - 5:00 C1:Z1
    =if(AND(C$1>=$A2,C$1<$B2),1," ") returns "1" in Row 2 for each hour worked.
    I am stumped as to the formula required to return "1" for a shift that spans midnight

    Any help appreciated.

  2. #2
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: Show each hour worked in shift over midnight

    When i've worked with times, the only way to get midnight to work is by formatting the cells as [hh]:mm.. 25:00 = 1am ~ 30;00 = 6am

    Then one - the other should work..

    Hope this is what you are after

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Show each hour worked in shift over midnight

    Any chance we could see the workbook?
    Makes it FAR easier to help out.

    BSB

  4. #4
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Show each hour worked in shift over midnight

    No need to see the sheet, the post gives adequate information.

    Try this one

    =IF($B2>$A2,IF(AND(C$1>=$A2,C$1<$B2),1,""),IF(OR(C$1>=$A2,C$1<$B2),1,""))

  5. #5
    Registered User
    Join Date
    12-29-2015
    Location
    Telford, England
    MS-Off Ver
    2010
    Posts
    5

    Re: Show each hour worked in shift over midnight

    Many thanks jason b.75, a perfect solution. I had almost got there in an earlier iteration but missed the subtlety of the "OR".

    Thanks to others for your suggestions.

+ 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. Calculating Time Worked when Clocking out after Midnight
    By tstjuste in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-27-2013, 03:05 PM
  2. The midnight hour
    By PhilT in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-27-2013, 01:52 AM
  3. [SOLVED] Calculating hours worked beyond midnight
    By Boville in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-25-2012, 12:22 PM
  4. Time worked after midnight
    By kaps_mr2 in forum Excel General
    Replies: 5
    Last Post: 04-30-2012, 07:45 AM
  5. Calculating Hours Worked from Shift Begin and Shift End
    By lukeflegg in forum Excel General
    Replies: 5
    Last Post: 08-12-2011, 03:25 PM
  6. Excel 2007 : Formula - hours worked past midnight
    By Belatrix101 in forum Excel General
    Replies: 10
    Last Post: 12-18-2009, 03:45 AM
  7. Countif Across the Midnight Hour
    By meach741 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-06-2006, 08:25 AM
  8. hour count after midnight
    By [email protected] in forum Excel General
    Replies: 3
    Last Post: 02-14-2006, 03:15 PM

Tags for this Thread

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