+ Reply to Thread
Results 1 to 4 of 4

Excel time sheet trouble after midnight

  1. #1
    Registered User
    Join Date
    03-21-2008
    Posts
    1

    Excel time sheet trouble after midnight

    I have a problem with my time sheet not giving me the proper value after midnight.. here is the code im using... =TEXT((E4-B4)+(I4-F4),"h:mm")
    Attached Files Attached Files

  2. #2
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852
    Try the ABS formula. It will give you the absolute difference between 2 times. (Format result cell as hh:mm)

    =ABS(A1-A2)

    Or

    the MOD formula

    =MOD(A1-A2,1)
    Last edited by Portuga; 03-21-2008 at 11:56 PM.
    If you found the solution to your question. Mark the thread as "Solved"
    Thank everyone that helped you with a valid solution by clicking on their

    There is no such thing as a problem, only a temporary lack of a solution

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,941
    Please look:
    Attached Files Attached Files
    Ben Van Johnson

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699
    Quote Originally Posted by Portuga
    Try the ABS formula. It will give you the absolute difference between 2 times. (Format result cell as hh:mm)

    =ABS(A1-A2)

    Or

    the MOD formula

    =MOD(A1-A2,1)
    I don't believe ABS is appropriate. If you have start time of 22:00 and end time of 06:00 then ABS would give a result of 16:00 rather than 8:00.

    MOD is good though, i.e.

    =MOD(E4-B4,1)+MOD(I4-F4,1)

    or

    =E4-B4+(B4>E4)+I4-F4+(F4>I4)

    in either case format result cell as h:mm [that's a better approach than using the TEXT function which gives a text string result]

+ 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