+ Reply to Thread
Results 1 to 7 of 7

Changing the Answer formula calculates

  1. #1
    Registered User
    Join Date
    01-08-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    7

    Changing the Answer formula calculates

    How do I edit this formula to add up to 8 instead of 7 where it is "Hours Worked"?

    =IF(C13=0,0,IF(F13=0,0,((+F13-C13)-(E13-D13))*24))

    I have attached the timesheet I am trying to edit

    This formula is the final total cell in a row of cells where the time is entered.

    ie "IN"(start of work day) "OUT"(for lunch) "IN"(from lunch) "OUT"(end of work day) "Hours Worked"

    Currently this formula subtracts the lunch time from the total hours worked.
    Attached Files Attached Files
    Last edited by johnlyons; 01-08-2009 at 04:56 PM. Reason: found another problem with result

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    If you mean you wish to include lunch in hours worked:

    =IF(OR(N(C13)=0,N(F13)=0),0,(F13-C13)*24)

    (changed at 17:00 UK to mirror existing check of 0 values)
    Last edited by DonkeyOte; 01-08-2009 at 01:00 PM.

  3. #3
    Registered User
    Join Date
    01-08-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    7
    That was perfect. I knew I could count on the forum for the answer. Bless you>

  4. #4
    Registered User
    Join Date
    01-08-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    7
    I just found a problem with the calculation.

    =IF(OR(N(C25)=0,N(F25)=0),0,(F25-C25)*24)

    If a person signs "IN" at 10:00 PM and "out" at 2:00 AM the result is a negative number. How do we fix that?

  5. #5
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Calculating elapsed time that crosses midnight

    Try this:
    Please Login or Register  to view this content.
    Does that help?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  6. #6
    Registered User
    Join Date
    01-08-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    7
    Hi Ron,

    That formula is 12 hours too high.

    ie: 10:00 PM to 1:00 AM, the result of this formula is 15, when it should be 3

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531
    are you sure you entered 10 PM and not 10 (as in AM ?)

    the formula should work without issue.

+ 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