+ Reply to Thread
Results 1 to 7 of 7

Unable to get formula to subtract 30 minutes for lunch if over 6 hours are worked

  1. #1
    Registered User
    Join Date
    03-04-2012
    Location
    savanna, illininois
    MS-Off Ver
    Excel 2010
    Posts
    2

    Unable to get formula to subtract 30 minutes for lunch if over 6 hours are worked

    I am working on a time sheet and so far I have the formula figured out to add up the hours from the time I input as =TEXT(C1-B1,"h:mm"). The formula I am trying to figure out is if this formula equals 7:00 and I need to subtract 30 minutes if the total is over 6:00 what is my next step. Trying to set up a payroll and need to subtract lunch if a person works over 6 hours. Any help would be greatly apprieciated.
    Last edited by buck8269; 03-04-2012 at 05:08 PM. Reason: Notified I had an incorrect and to generic of a title, asked to repost per forum rules with problem in the title not the solution I am looking for.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2504
    Posts
    13,640

    Re: Help with formula

    Hi

    maybe first adapt your title per forum rules ?

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Help with formula

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    03-04-2012
    Location
    savanna, illininois
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Help with formula

    Sorry for my mistake, I misunderstood what my title needed to say in the rules. Thank you, I have made the changes with the hopes that I am more appropriate with my information.

  5. #5
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,082

    Re: Unable to get formula to subtract 30 minutes for lunch if over 6 hours are worked

    Try

    =TEXT((C1-B1)-(C1>TIMEVALUE("07:00:00"))*TIMEVALUE("00:30:00"),"h:mm")
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

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

    Re: Unable to get formula to subtract 30 minutes for lunch if over 6 hours are worked

    Quote Originally Posted by buck8269 View Post
    I am working on a time sheet and so far I have the formula figured out to add up the hours from the time I input as =TEXT(C1-B1,"h:mm"). The formula I am trying to figure out is if this formula equals 7:00 and I need to subtract 30 minutes if the total is over 6:00 what is my next step. Trying to set up a payroll and need to subtract lunch if a person works over 6 hours.
    Using TEXT function is normally a mistake - as the name implies it formats the result as text which might inhibit your ability to use that result in further calculations, for your initial formula a simple subtraction would be better

    =C1-B1

    then use formatting to format cell as h:mm

    To subtract 0:30 if the initial length is 6 hours or more try

    =C1-B1-IF(C1-B1>="6:00"+0,"0:30")
    Audere est facere

  7. #7
    Registered User
    Join Date
    07-05-2022
    Location
    Orlando, FL
    MS-Off Ver
    10
    Posts
    4

    Re: Unable to get formula to subtract 30 minutes for lunch if over 6 hours are worked

    Yes, I think it worked! thank you so much for your help!!

+ 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