+ Reply to Thread
Results 1 to 5 of 5

Simple difference between hours function problem

  1. #1
    Forum Contributor ryan4646's Avatar
    Join Date
    06-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003, 2007
    Posts
    134

    Simple difference between hours function problem

    Hi Folks,

    I am back after long time. I missed you guys. Ok, here is my problem.

    I am making a time sheet. Now, in Column E, it should show the difference between each hour when I subtract C-D or D-C. But it is either showing me time, or ######## or if i change the format to number, a decimal value.

    For example, for number 1, from C3 to D3, it should be 7 hours worked in total, but it is showing me pathetic result.

    Note: Most of the time the work starts at night in one day (for example Saturday), and as it finish at 3 or 4 am, that means it is finishing in next day (sunday.


    Hope i made it clear. Thanks in advance.

    Attaching file
    Attached Files Attached Files
    thanks,

    Ryan

  2. #2
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Simple difference between hours function problem

    That happens when the result of a time calculation is negative. Your working results are also wrong because you have your formula backwards.

    Try this one in E3, then fill down

    =D3-C3+(D3<C3)

    Or, to explain the logic, =Finish time - Start time + (Finish time less than Start time) which adds a day to the finish time, which turns 03:00 into 27:00, so the time can be calculated correctly.

  3. #3
    Forum Contributor ryan4646's Avatar
    Join Date
    06-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003, 2007
    Posts
    134

    Re: Simple difference between hours function problem

    awesome. it worked. but i am having another problem is that, calculating the pay.

    In pay section, when i am multiplying the E3 and G3, it should show me $35, sensing 5*7. but it is showing me different one. may be because i am multiplying with hours. how to fix that ??

    attaching file again and thanks in advance.
    Attached Files Attached Files

  4. #4
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Simple difference between hours function problem

    try below in H3
    =E3*G3*24
    and you can also use
    =MOD(D3-C3,1) in E3
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  5. #5
    Forum Contributor ryan4646's Avatar
    Join Date
    06-10-2013
    Location
    Australia
    MS-Off Ver
    Excel 2003, 2007
    Posts
    134

    Re: Simple difference between hours function problem

    Your guys are awesome.

    This problem is solved now.. owhooo.. adding rep to everyone.
    Last edited by ryan4646; 09-12-2018 at 06:54 AM.

+ 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. Replies: 2
    Last Post: 08-07-2017, 06:25 PM
  2. Replies: 2
    Last Post: 08-06-2017, 08:54 PM
  3. Seperate simple hours, holiday hours and night hours
    By enitron in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-27-2014, 07:22 AM
  4. Counting difference between hours if outside of business hours
    By joytech22 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 07-15-2013, 05:03 AM
  5. Replies: 4
    Last Post: 02-03-2013, 01:17 AM
  6. loop vs. simple function, huge difference in speed, why?
    By losmi8 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-22-2010, 04:33 AM

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