+ Reply to Thread
Results 1 to 9 of 9

Lookup formula best for this?

  1. #1
    Registered User
    Join Date
    11-17-2015
    Location
    Devon,England
    MS-Off Ver
    Excel 07
    Posts
    7

    Lookup formula best for this?

    As i'm pretty much newbie at excel finding it quite troublesome.

    I'm making some sort of "Time Sheet", employee's fill out time the start job, and time they finish.

    So for example

    Start Time A1 = 8:00
    Finish Time A2 = 10:00
    Total Time A3 = 2:00 (SUM A2-A1)

    Thats the simple bit.
    However if A2 had a time of 10:45, it would actually need a formula to take 0:15 off, because we have tea break, from 10:00 - 10:15.
    Furthermore it had a time of 14:00 it would need to take a further 0:45 off, for lunch break, from 13:00 - 13:45.


    So if would someone would be kind enough, to help me get near to it. Cells don't matter I can change them around as needed, just the formula I'm stuck on.


    Many Thanks
    Stuart

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,228

    Re: Lookup formula best for this?

    Try

    =IF(A2>TIME(14,0,0),A2-A1-(1/24),IF(A2>TIME(10,15,0),A2-A1-(1/96),A2-A1))

    or

    =IF(A2>14/24,A2-A1-(1/24),IF(A2>10.25/24,A2-A1-(1/96),A2-A1))

    In Excel 24 hours=1 so 1 hour=1/24 and 15 mins = 1/96

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Lookup formula best for this?

    Hi,

    One way

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    11-17-2015
    Location
    Devon,England
    MS-Off Ver
    Excel 07
    Posts
    7

    Re: Lookup formula best for this?

    Awesome thank you very much

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Lookup formula best for this?

    My pleasure and thanks for the rep.

  6. #6
    Registered User
    Join Date
    11-17-2015
    Location
    Devon,England
    MS-Off Ver
    Excel 07
    Posts
    7

    Re: Lookup formula best for this?

    Ok tiny little problem.

    If someone starts at 12:00, rather than 8:00, it's still taking the 0:15 off, that they would have at 10:00. But it doesn't need to because they started it after the tea break of 10:00.


    I've been fiddling around trying different things, and it's got me stumped.


    Thanks again.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,228

    Re: Lookup formula best for this?

    Try

    =A2-A1-IF(A1<(10/24),0.25/24,0)-IF(A2>(13.75/24),0.75/24,0)
    Last edited by JohnTopley; 05-15-2016 at 10:45 AM.

  8. #8
    Registered User
    Join Date
    11-17-2015
    Location
    Devon,England
    MS-Off Ver
    Excel 07
    Posts
    7

    Re: Lookup formula best for this?

    Yep that works.

    Thanks once again for your help

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,228

    Re: Lookup formula best for this?

    Edited the last formula: see post #7

+ 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 for lookup for left side lookup
    By srinivasan1965 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-07-2016, 06:34 AM
  2. Replies: 4
    Last Post: 05-19-2015, 08:42 PM
  3. [SOLVED] Lookup formula to find lowest value with variable lookup criteria
    By brharrii in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-27-2015, 03:00 AM
  4. [SOLVED] Can lookup formula ignore blank cells until the lookup value has been entered?
    By Ju1cy in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-13-2014, 01:32 PM
  5. Create a lookup formula with an If or Lookup function
    By afountas21 in forum Excel General
    Replies: 2
    Last Post: 09-05-2012, 06:53 PM
  6. Replies: 5
    Last Post: 02-24-2011, 11:26 AM
  7. Replies: 3
    Last Post: 10-10-2005, 01:05 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