+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    09-06-2008
    Location
    Denver
    Posts
    8

    Time Sheet Schedule

    I know this is going to be easy for someone, but I am stumped, again.

    What I need to do is calculate the hours between two clock times minus 30 minutes.

    Example:
    Cell A1 - 4:00am
    Cell B1 - 16:30
    I need Cell C1 to say 12 (hours)

    Also:

    Cell A2 - 17:30
    Cell B2 - 02:00am
    I need cell c2 to say 8 (hours)


    Thanks for your help.
    Last edited by davesexcel; 11-24-2009 at 01:45 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Cochrane,Alberta
    MS-Off Ver
    XL 2003,2007
    Posts
    6,259

    Re: Time Sheet Schedule

    Here is one way
    =IF((B1-A1)<0,((B1+12)-A1)-TIME(,30,0),(B1-A1)-TIME(,30,))
    Dave


  3. #3
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    10,477

    Re: Time Sheet Schedule

    with start in a1 finish in b1 eg 18:00 to 01:00
    =(B1-A1+(B1<A1))-1/48 gives answer as time eg 06:30 cell formatted time
    or as a decimal
    =(B1-A1+(B1<A1))*24-0.5 gives 6.5 cell formatted general
    Last edited by martindwilson; 11-22-2009 at 10:45 AM.
    Mojito connoisseur and a dabbler in Cisco
    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

  4. #4
    Registered User
    Join Date
    09-06-2008
    Location
    Denver
    Posts
    8

    Re: Time Sheet Schedule

    the second one worked perfectly Martin, Now 1 more question: Can I add an If formula to it if the answer is less than 1. Reason being if they are off and there arent any times in it it calculates -5 for the 30 min lunch.

    Thanks Again!

  5. #5
    Forum Guru martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    10,477

    Re: Time Sheet Schedule

    =if((B1-A1+(B1<A1))*24-0.5<1,0,(B1-A1+(B1<A1))*24-0.5)
    Mojito connoisseur and a dabbler in Cisco
    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

  6. #6
    Forum Guru darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Colorado, US
    MS-Off Ver
    2007
    Posts
    2,140

    Re: Time Sheet Schedule

    If you just want to avoid negative numbers, =MAX(MOD(B1-A1-1/48,1),0)*24 is a little shorter and should do the same thing.

  7. #7
    Registered User
    Join Date
    09-06-2008
    Location
    Denver
    Posts
    8

    Re: Time Sheet Schedule

    thank you all! How do I enter this as solved?

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.2.0