+ Reply to Thread
Results 1 to 8 of 8

How can I get my formula to deduct lunch breaks based on hours worked?

  1. #1
    Registered User
    Join Date
    03-09-2013
    Location
    milton keynes, england
    MS-Off Ver
    Excel 2003
    Posts
    6

    How can I get my formula to deduct lunch breaks based on hours worked?

    Hi there,

    I have created a spread sheet to record staff hours worked. The shifts worked are recorded into the cell as 09:00-18:00 and I have then created the following formula to total the hours worked each week;

    =SUM(IF(ISNUMBER(LEFT(C4:I4,5)+0),RIGHT(C4:I4,5)-LEFT(C4:I4,5)-(RIGHT(C4:I4,5)-LEFT(C4:I4,5)>=1/3)*1.5/24))*24

    This currently says that if they work more than 8 hours they should be deducted 1.5hrs for a break, however, I also want it to say if you work less than 8 hours you only get 0.5 hours break.

    I have tried every which way to add this in but it wont work...Please help?

    Thanks

  2. #2
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: How can I get my formula to deduct lunch breaks based on hours worked?

    What's in C4:I4?
    Or better, could you post your workbook or relevant part of it?
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  3. #3
    Registered User
    Join Date
    03-09-2013
    Location
    milton keynes, england
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: How can I get my formula to deduct lunch breaks based on hours worked?

    Sorry, it wont upload my file.

    C5 contains the hours worked on Monday in the format 10:00-19:00
    D5 contains Tuesdays hours 10:00-19:00
    E5 contains Wednesdays hours, which in this case is day off, so contains D/O.
    F5 contains Thursdays hours, and so on...

    so in J5 I have my formula to calculate how many hours have been worked, minus the 1.5 hrs break, but in some cases they will work 6 hours and will only have a half hour break.

  4. #4
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: How can I get my formula to deduct lunch breaks based on hours worked?

    I think this will do the trick.
    Deducts 1.5 hrs if worked 8 hrs or more and 0.5 hrs if worked less than 8 hrs.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Don't forget to close the formula with [ctrl]+[enter] as it is an array formula.
    Last edited by Tsjallie; 11-22-2013 at 06:13 AM.

  5. #5
    Registered User
    Join Date
    03-09-2013
    Location
    milton keynes, england
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: How can I get my formula to deduct lunch breaks based on hours worked?

    Hi,

    Thanks for coming back to me.

    This hasn't worked though

    It now gives me the result of 1.52 when it should be 36.5

    Any ideas?

  6. #6
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: How can I get my formula to deduct lunch breaks based on hours worked?

    Hmm, I do not understand what the values are which you are referring at (1.52, 36.5).
    I'm posting a workbook to demonstrate the formula which seems to be working fine in there.
    Perhaps with this demo you can figure what I'm doing different than you are.
    Attached Files Attached Files

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: How can I get my formula to deduct lunch breaks based on hours worked?

    I think nikijune's original formula returns the hours as a decimal value....so you'd need to multiply the result by 24 to get that....or use this version

    =SUM(IF(ISNUMBER(LEFT(C4:I4,5)+0),(RIGHT(C4:I4,5)-LEFT(C4:I4,5))*24-LOOKUP((RIGHT(C4:I4,5)-LEFT(C4:I4,5))*24,{0,0.5;8,1.5})))
    Audere est facere

  8. #8
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: How can I get my formula to deduct lunch breaks based on hours worked?

    I think nikijune's original formula returns the hours as a decimal value ..
    That's exactly my "aha-erlebnis" of one minute ago
    He won't need to alter the formula, though, but just format the cell as time ([u]:mm).
    Thx for thinking with us

+ 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. Replies: 6
    Last Post: 07-05-2022, 01:06 PM
  2. Replies: 2
    Last Post: 11-11-2015, 05:51 AM
  3. [SOLVED] Error on Formula, Hours Worked - Breaks
    By suvoth in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-12-2013, 09:55 PM
  4. Automatically deduct lunch breaks
    By cgolivas in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-02-2013, 04:12 PM
  5. Replies: 2
    Last Post: 03-22-2012, 01:17 PM

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