+ Reply to Thread
Results 1 to 6 of 6

Calculate hours worked for a shift with lunch break

  1. #1
    Forum Contributor
    Join Date
    08-22-2016
    Location
    london
    MS-Off Ver
    2013
    Posts
    121

    Calculate hours worked for a shift with lunch break

    Hi

    I am trying to calculate the hours worked in a day with or without a lunch break

    so i have

    A1 | B1 | C1 | D1
    time in | lunch start | lunch End | time out

    I have the formula

    =SUM(IF(B1<A1,B1+1,B1)-A1,If(D1<C1,D1+1,D1)-C1)

    so i can calculate the time, when there is a break added, but i need to be able to calculate the time, when there are no values in B1 AND C1 and when there is just a value in B1 it calculates the total time with out a break, and the same for C1

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,911

    Re: Calculate hours worked for a shift with lunch break

    Quote Originally Posted by kobiashi View Post
    when there is just a value in B1 it calculates the total time with out a break, and the same for C1
    Do you mean there would be a start and end date but only one of the lunch times, either start or end?

    i.e. only 3 of the 4 filled out?

    BSB

  3. #3
    Forum Contributor
    Join Date
    08-22-2016
    Location
    london
    MS-Off Ver
    2013
    Posts
    121

    Re: Calculate hours worked for a shift with lunch break

    Yeh

    so if B1 and C1 are filled in then calculate the break time,

    but if only B1 or C1 is filled in dont calculate the break, the reason i ask this, is i have another formula which will work out the time with or without the break added, but if you add a time to just B1 or C1 then the total time is completely wrong

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,911

    Re: Calculate hours worked for a shift with lunch break

    Perhaps this will do what you need?
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    BSB

  5. #5
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,491

    Re: Calculate hours worked for a shift with lunch break

    there is no need to cross check breaktimes against start and end times
    start and endtime determine the total duration. you might want to check if end time is smaller if company has nightshifts
    and start break and end break will cause a deduction. you can test the endbreak against startbreak but with a normal 30 min break chance is very small it will occor.

    the simplest formula
    =D1-A1-if(COUNT(B1:C1)=2;C1-B1;"")

    if your company has shifts that go past midnight then you need the "smaller than" tests but you only need to test workday and break times against eachother

    If(D1<A1;D1+1;D1)-A1-if(COUNT(B1:c1)=2;if(B1<C1;C1+1;C1)-B1;"")
    Last edited by Roel Jongman; 06-10-2018 at 05:22 AM.

  6. #6
    Forum Contributor
    Join Date
    08-22-2016
    Location
    london
    MS-Off Ver
    2013
    Posts
    121

    Re: Calculate hours worked for a shift with lunch break

    Quote Originally Posted by BadlySpelledBuoy View Post
    Perhaps this will do what you need?
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    BSB
    worked a treat thank you

+ 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. [SOLVED] Formula to calculate hours worked w/lunch or w/o + OT column only total after 40 hours
    By blinhart in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-31-2023, 11:14 AM
  2. Replies: 8
    Last Post: 09-30-2017, 07:00 PM
  3. Replies: 1
    Last Post: 05-11-2017, 10:14 AM
  4. Replies: 2
    Last Post: 01-17-2014, 02:22 PM
  5. [SOLVED] Adding Hours Worked minus lunch break IF over 5 hours
    By Gtrtim112 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-15-2013, 11:16 PM
  6. Replies: 4
    Last Post: 02-12-2013, 07:01 AM
  7. Replies: 2
    Last Post: 02-11-2013, 02:26 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