+ Reply to Thread
Results 1 to 5 of 5

Formula required to calculate Time difference between Total Hours and Hours Worked

  1. #1
    Registered User
    Join Date
    06-21-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    61

    Formula required to calculate Time difference between Total Hours and Hours Worked

    Hello All,

    I am using Excel 2013 and I am stuck with a formula for time difference as shown in the attached sample.

    I wish to calculate the difference between Total Hours (Col B) and Worked Hours (Col C) and display the result in Col D in in hh:mm format.

    Any help would be greatly appreciated.

    TIA

  2. #2
    Valued Forum Contributor
    Join Date
    07-23-2013
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    988

    Re: Formula required to calculate Time difference between Total Hours and Hours Worked

    You have total hours input as a number of hours, but then worked hours input as a number of days (formatted to show as number of hours). It would be preferable to fix this so they have the same underlying value, but if that's not possible then:

    =B2/24-C2

    Will give you the difference (as a number of days). You can format this the same as column C, although it will not deal with negative numbers (e.g. the last 4 rows of your example). I don't know what you want to show here.

  3. #3
    Registered User
    Join Date
    06-21-2016
    Location
    India
    MS-Off Ver
    2013
    Posts
    61

    Re: Formula required to calculate Time difference between Total Hours and Hours Worked

    Dear Nick,
    Thanks for the prompt response.

    As mentioned by you, it does not work for the last 4 rows.
    Any suggestions how can we solve the issue as the employee have put in more time in those months.

    Thanks once again for your time and help.

  4. #4
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,465

    Re: Formula required to calculate Time difference between Total Hours and Hours Worked

    Without using the 1904 time system, Excel cannot display negative times.

    One possibility is to calculate all times positive (=ABS(B3-C3)),
    but if C3>B3 format the times differently using Conditional Formatting rules, so that you see that it is a negative time.

    Furthermore, I would consider calculating the hours everywhere in days (that is independent of showing in hours), then the formulas remain the simplest.

  5. #5
    Valued Forum Contributor
    Join Date
    07-23-2013
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    988

    Re: Formula required to calculate Time difference between Total Hours and Hours Worked

    The question is what do you want as a result when they have done overtime? Do you want to show a negative time? Or something else?

    IF you want a negative time you could use this formula in D2, copied down:

    =IF(B2/24>=C2,TEXT(B2/24-C2,"[h]:mm"),"-"&TEXT(C2-B2/24,"[h]:mm"))

    Edit - the downside of this is that the result becomes text, which might be a problem if you then use it for something else.

+ 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 to calculate hours worked w/lunch or w/o + OT column only total after 40 hours
    By blinhart in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-31-2023, 11:14 AM
  2. [SOLVED] Calculate total hours worked between 2 date/time stamps ignoring weekends and holidays
    By drewship in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-01-2015, 09:59 AM
  3. [SOLVED] Looking for formula help finding total hours worked in military time
    By Mic4220 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-08-2015, 02:42 PM
  4. Replies: 1
    Last Post: 06-14-2013, 02:09 AM
  5. Replies: 4
    Last Post: 02-12-2013, 07:01 AM
  6. Replies: 2
    Last Post: 02-11-2013, 02:26 PM
  7. How do I get difference between hours worked vs. required number
    By ChicagoMerchant in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-19-2007, 04:18 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