+ Reply to Thread
Results 1 to 5 of 5

calculate shift duration

Hybrid View

jeffbrown1966 calculate shift duration 04-28-2010, 11:51 PM
protonLeah Re: Need help with IF 04-29-2010, 12:11 AM
jeffbrown1966 Re: Need help with IF 04-29-2010, 09:13 AM
zbor Re: Need help with IF 04-29-2010, 01:59 AM
DonkeyOte Re: Need help with IF 04-29-2010, 04:14 AM
  1. #1
    Registered User
    Join Date
    04-28-2010
    Location
    Oklahoma
    MS-Off Ver
    Excel 2007
    Posts
    2

    Question calculate shift duration

    I need to subtract .50 from a cell if it is over 6.00 I have a formula but can not get it to work

    =IF(H6="P",G6+12-F6,IF(H6="A",G6-F6,(IF(I6>6,I6-0.5,(I6/24)))))

    IN OUT
    9.00 5.00 P would equal 8 hours I would like it to subtract .50 from the 8 hours


    Thank you
    Last edited by jeffbrown1966; 04-29-2010 at 08:40 AM. Reason: retitle

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,962

    Re: Need help with IF

    for the sample provided:
    =IF(B1+(12*(A1>B1))-A1>6,B1+(12*(A1>B1))-A1-0.5,B1+(12*(A1>B1))-A1)
    where 12*(A1>B1) if the out time is less than the end time, then A1>B1 returns TRUE OR "1" else "0"
    Last edited by protonLeah; 04-29-2010 at 10:55 PM. Reason: dropped a bracket
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    04-28-2010
    Location
    Oklahoma
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Need help with IF

    [QUOTE=protonLeah;2297008]for the sample provided:
    CODE]=IF(B1+(12*(A1>B1))-A1>6,B1+(12*(A1>B1))-A1-0.5,B1+(12*(A1>B1))-A1)[/CODE]
    where 12*(A1>B1) if the out time is less than the end time, then A1>B1 returns TRUE OR "1" else "0"[/QUOTE


    This one worked great until there was a 12 hour shift I tried the >= but it did not work

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,057

    Re: Need help with IF

    How about this:

    =IF(MOD(H6-G6,1)>1/4,MOD(H6-G6,1)-1/48,MOD(H6-G6,1))
    Never use Merged Cells in Excel

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Need help with IF

    If we assume the values are integers rather than true time - then adapting zbor's suggestion:

    =MOD(G6-F6,12)-0.5*(MOD(G6-F6,12)>6)

    Per forum rules please retitle your thread though to something more appropriate - eg "calculate shift duration" (this helps others with similar questions)

+ 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