+ Reply to Thread
Results 1 to 6 of 6

Calculating time after midnight

  1. #1
    Registered User
    Join Date
    08-09-2004
    Location
    auckland
    MS-Off Ver
    MS Office Professional Plus 2016
    Posts
    72

    Calculating time after midnight

    Hi. I am trying to make a formula for a work timesheet.
    By using the hours entered I want to work out how many hours after midnight have been worked (its a penalty rate).
    I have tried using a simple "if end time>0" formula, but of course excel assumes all times are greater than zero.
    I think it needs to incorporate the start time in the formula so that it knows midnight has been passed.
    Any ideas?

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,697
    How do you define "after midnight". Is that between midnight and a specific time, e.g. 0:00 to 06:00?

    What is the range of possible start and end times?

  3. #3
    Registered User
    Join Date
    08-09-2004
    Location
    auckland
    MS-Off Ver
    MS Office Professional Plus 2016
    Posts
    72
    basically start and end times a limitless. But assuming I start before midnight, 8:00 for example, then any period work after midnight is a penalty, be it 2 hours at 2:00, or 11 hours at 11:00.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,697
    If start time is in A2 and end time in B2 use this formula in C2

    =(A2>B2)*B2

    format C2 as h:mm

  5. #5
    Registered User
    Join Date
    08-09-2004
    Location
    auckland
    MS-Off Ver
    MS Office Professional Plus 2016
    Posts
    72
    Thanks, thats great. How do I display it in a number, ie, 2:30 = 2.5 hours

  6. #6
    Registered User
    Join Date
    08-09-2004
    Location
    auckland
    MS-Off Ver
    MS Office Professional Plus 2016
    Posts
    72
    =((A2>B2)*B2)*24

    got it myself

    Thanks for the help

+ 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