+ Reply to Thread
Results 1 to 16 of 16

elapsed time with condition

  1. #1
    Registered User
    Join Date
    11-03-2011
    Location
    jombang,Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    24

    elapsed time with condition

    hi i want to know how to get elapse time with few conditions:

    1. everyday at shift 2 the recess time between 18.00-19.00
    2. everyday except Friday the recess time 11.30-12.30 and Friday the the recess time 11.30-13.00
    3. so the result is the elapse time exclude the recess time
    i also have attached the file

    thanks in advance
    Attached Files Attached Files
    Last edited by mtsf; 11-11-2011 at 03:31 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    08-23-2009
    Location
    Hampshire, UK
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    328

    Re: elapsed time with condition

    Assuming the recess applies irrespective of the number of hours worked you could use the following formula in cell F2 and copied down

    =IF(B2="Fri",MAX(0,CHOOSE(C2,11/24,18/24)-D2)+MAX(0,E2-CHOOSE(C2,12/24,19/24)),MAX(0,CHOOSE(C2,11.5/24,18/24)-D2)+MAX(0,E2-CHOOSE(C2,12.5/24,19/24)))

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

    Re: elapsed time with condition

    When I tried that formula it gave me 3:00 in F4, shouldn't that be 1:00? My suggestion would be this formula

    =E2-D2-MAX(0,MIN(E2,IF(C2=2,"19:00",IF(B2="Fri","13:00","12:30")))-MAX(D2,IF(C2=2,"18:00","11:30")))
    Audere est facere

  4. #4
    Valued Forum Contributor
    Join Date
    08-23-2009
    Location
    Hampshire, UK
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    328

    Re: elapsed time with condition

    Thanks daddylonglegs - my formula didn't work for shifts that didn't include the recess. Also I had the Friday recess ending at 12:30 instead of 13:00.

  5. #5
    Registered User
    Join Date
    11-03-2011
    Location
    jombang,Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: elapsed time with condition

    if number 2. "everyday except Friday the recess time 11.30-12.30 and Friday the the recess time 11.30-13.00 for shift 1" so then we cant use this formula rite??and how about the formula then

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

    Re: elapsed time with condition

    Did you try the formula I suggested?

    If that doesn't work then please post some concrete example showing the times/shifts/days etc. and required results

  7. #7
    Registered User
    Join Date
    11-03-2011
    Location
    jombang,Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: elapsed time with condition

    Quote Originally Posted by daddylonglegs View Post
    Did you try the formula I suggested?

    If that doesn't work then please post some concrete example showing the times/shifts/days etc. and required results
    oh i just read your earlier post..that's right.ur formula work.thanks a lot.btw..can u explain the formula at glance in plain english?

  8. #8
    Registered User
    Join Date
    11-03-2011
    Location
    jombang,Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: elapsed time with condition

    Hi all cound you help me again, if then the condition become :
    1. everyday at shift 2 the recess time between 18.00-19.00
    2. Sunday-Thursday the recess time 11.30-12.30 and Friday the the recess time 11.30-13.00 and saturday no recess time
    3. so the result is the elapse time exclude the recess time

  9. #9
    Registered User
    Join Date
    11-03-2011
    Location
    jombang,Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: elapsed time with condition

    anyone can help me?

  10. #10
    Registered User
    Join Date
    11-03-2011
    Location
    jombang,Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: elapsed time with condition

    anyone can solve this problem??

  11. #11
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: elapsed time with condition

    Hello,

    Please try this formula:
    Please Login or Register  to view this content.
    This one is totally based on the formula posted by daddylonglegs.

    Hope this help.
    (copy pasta from Ford)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools

    Regards,
    Lem

  12. #12
    Registered User
    Join Date
    11-03-2011
    Location
    jombang,Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: elapsed time with condition

    HI Lemice thanks for helping me,but a bit problem here if in the second shift..saturday the start time is 12:30 the finish time is 15:30 it will result 2 hour but it should be 3 hours.can you reedit this code once again

  13. #13
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: elapsed time with condition

    Sorry, in the post above I thought I read it "everyday at shift 2 the recess time between 18.00-19.00"
    Try this formula instead
    Please Login or Register  to view this content.
    Hope this help.

  14. #14
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: elapsed time with condition

    ...........................
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  15. #15
    Registered User
    Join Date
    11-03-2011
    Location
    jombang,Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: elapsed time with condition

    HI lemice, thanks for editing the code, but when i try to input:
    day shift start time finish time
    mon 1 07:30 10:30

    it will result 120 instead of 180, please re edit it again thanks a lottt

  16. #16
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: elapsed time with condition

    I really am sorry for editing the formula without testing everything out
    Try this one instead
    Please Login or Register  to view this content.
    Let me know if somehow it still does not match all of your criteria

  17. #17
    Registered User
    Join Date
    11-03-2011
    Location
    jombang,Indonesia
    MS-Off Ver
    Excel 2003
    Posts
    24

    Re: elapsed time with condition

    Hi Lemice,
    Thanks again and it work perfectly...
    Last edited by mtsf; 04-17-2013 at 04:20 AM.

+ 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