+ Reply to Thread
Results 1 to 9 of 9

Timesheet problem:distinguishes between Normal Time and Overtime,

  1. #1
    Registered User
    Join Date
    05-03-2007
    Location
    Sydney
    Posts
    17

    Timesheet problem:distinguishes between Normal Time and Overtime,

    I need to setup a timesheet that distinguishes between Normal Time and Overtime, with Overtime being work between the hours of 22:30 and 06:30, and all other time is Normal.
    What I need is how to do this for the yellow cells in the attached sample.
    Attached Files Attached Files

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    May be these links will help?

    http://www.j-walk.com/ss/excel/files/timesht.htm

    http://www.cpearson.com/excel/overtime.htm
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    05-03-2007
    Location
    Sydney
    Posts
    17
    Unfortunately those links don't cover what my problem is - I've already tried all the links I could find but none of them cover the area of my problem.

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    You may be able to do this more easily depending on what shifts are possible but this should give you the result you want assuming all shift are less than 24 hours long.

    In E5

    =(C5>D5)*MEDIAN(0,D5-"6:30","16:00"+0)+MAX(0,MIN("22:30"+0, D5+(C5>D5))-MAX("6:30"+0,C5))

    and in F5

    =MOD(D5-C5,1)-E5

    format both as time and copy down

    If your overtime period might be variable you can alter the hardcoded times in the formula for cell references to more easily change the period, note "16:00" represnts the length of the non-overtime period

  5. #5
    Registered User
    Join Date
    05-03-2007
    Location
    Sydney
    Posts
    17
    Thanks daddylonglegs that works, however is there any way I can get the result as a number rather than time. There is a series of calculations that are based on the result, and these won't work if the format is time.

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    If you want the result in decimal hours, e.g. 8.5 rather than 8:30 then just multiply by 24 so the above formulas would become:

    =((C5>D5)*MEDIAN(0,D5-"6:30","16:00"+0)+MAX(0,MIN("22:30"+0, D5+(C5>D5))-MAX("6:30"+0,C5)))*24

    and

    =(MOD(D5-C5,1)-E5)*24

    format as number

  7. #7
    Registered User
    Join Date
    05-03-2007
    Location
    Sydney
    Posts
    17
    I am getting an error in F5, but correct result in E5

  8. #8
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Apologies, I just multiplied the F5 formula by 24 but, of course, because it refers to E5 and that has now also been multiplied by 24 I need to adjust accordingly. Change F5 to

    =MOD(D5-C5,1)*24-E5

  9. #9
    Registered User
    Join Date
    05-03-2007
    Location
    Sydney
    Posts
    17
    Many thanks daddylonglegs, works beautifully.

+ 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