1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Excel Timecard minus Lunch Break

Discussion in 'Business Applications' started by lola is bk, Apr 28, 2004.

Thread Status:
Not open for further replies.
Advertisement
  1. lola is bk

    lola is bk Thread Starter

    Joined:
    Apr 27, 2004
    Messages:
    3
    I need a formula that will keep track of hours worked (I can do that part of the formula) AND subtract 30 minutes for lunch if the employee works 5 hours or more.

    Ex. Start time 7:00 (A1)
    Quit time 15:30 (A2)
    Total Hours 8:30 (Clocked In)

    I tried A2-A1 and got the total hours but I need to have Excel automatically subtract :30 for lunch and I can't figure out how to do that.
    Someone on another forum suggested =IF((A2-A1)>5,A2-A1-0.5,A2-A1) but it didn't subtract the lunch break.
    Thanks for your help in advance.

    Lola
     
  2. maxflia10

    maxflia10

    Joined:
    Feb 24, 2003
    Messages:
    331
    Excel stores time as fractions of a day. 30 minutes is 1/48 of a day or 0.020833333. It's easier if you just enter 0:30 in a cell and reference the cell in your formula.

    =B1-A1-C1

    where C1 houses 0:30

    =B1-A1-1/48

    =B1-A1-"0:30"+0

    Custom format the cell that houses the formula as [h]:mm
     
  3. Anne Troy

    Anne Troy

    Joined:
    Feb 14, 1999
    Messages:
    11,746
    First Name:
    Anne
  4. rama4672

    rama4672

    Joined:
    Jun 1, 2003
    Messages:
    84
    you could try something like this

    =IF(COUNT(A1,B1)=2,(B1-A1+(B1<A1))*24,"")-0.5

    Ian
     
  5. lola is bk

    lola is bk Thread Starter

    Joined:
    Apr 27, 2004
    Messages:
    3
    Dreamboat,
    You truly ARE a Dreamboat. That link you sent me was exactly what I needed!!!!!!!!!!!!!!!!!!!!!!
    Thanks
     
  6. Anne Troy

    Anne Troy

    Joined:
    Feb 14, 1999
    Messages:
    11,746
    First Name:
    Anne
    Thanks, Lola. Glad to help. Lots of people love Chip's information on time/date in Excel. If you appreciate it, thank him, not me! :D But I understand... :)
     
  7. 0pak

    0pak

    Joined:
    May 20, 2007
    Messages:
    1
    hey rama4672 I tried your code: =IF(COUNT(D9,E9)=2,(E9-D9+(E9<D9))*24,"")-0.5

    and it works, but we still have a problem when an employee only works 4 hours and still is taken 30 min for lunch. We wanted to be if the total of hours = 5 hours or more then take out -0.5 for lunch..
     
  8. bomb #21

    bomb #21

    Joined:
    Jul 1, 2005
    Messages:
    8,546
    =IF(end_time-start_time<1/24*5,end_time-start_time,end_time-start_time-1/48)

    Just substitute "start_time" and "end_time" with appropriate cell references.

    HTH
     
  9. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/224529

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice