+ Reply to Thread
Results 1 to 6 of 6

Calculating time difference between two days combined with IF formula

  1. #1
    Registered User
    Join Date
    12-03-2013
    Location
    Darlington, England
    MS-Off Ver
    Excel 2007
    Posts
    18

    Calculating time difference between two days combined with IF formula

    Hi

    I am using the following formula in Column E to calculate the difference between an employees start time, and their previous shift end time in order to work out how many hours rest they have had:

    =IF(A4=0,"",IF(I4=0,"",MOD(I4-B4,1)))

    My Current Formula works fine for same day calculations, but if an employee finishes work at 18:00 on Friday and starts work at 22:00 Saturday night, Excel calculates the Total Rest hours as 04:00, when in fact they have had 28:00 hours rest...

    Is there a way of calculating the hours difference between two dates?


    I have attached a sample of my spreadsheet to illustrate
    Attached Files Attached Files

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Calculating time difference between two days combined with IF formula

    Try this.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Registered User
    Join Date
    12-03-2013
    Location
    Darlington, England
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Calculating time difference between two days combined with IF formula

    Hi Fotis

    Thanks for getting back to me! The formula looks good, but on row 8 it seems to add 1.00? I've attached the spreadsheet
    again with some other figures entered - if you look at row 8 the total rest hours calculates to 13.00 instead of 12.00?

    Any Suggestions?

    Thanks
    Attached Files Attached Files

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Calculating time difference between two days combined with IF formula

    Hi

    No i think that everythig works fine. The correct result in E8 is 13. Why to be twelve?

    e4=14--fin=17:00--start=07:00 >>ok
    e8=13---fin=18:00--start=07:00>>>>>here is exactly the same logic and it's ok.
    e7=12--fin=19:00---start=07:00>>ok

    Maybe to take a look again to the calculations?

  5. #5
    Registered User
    Join Date
    12-03-2013
    Location
    Darlington, England
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Calculating time difference between two days combined with IF formula

    My Apologies - you are correct - I think I've been starting at this too long now lol!

    Thank you so much for sorting for me

  6. #6
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Calculating time difference between two days combined with IF formula

    You are welcome and thanks for the feedback & rep.

+ 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: 3
    Last Post: 01-21-2014, 04:14 PM
  2. Calculating difference between working days
    By jantonio in forum Excel General
    Replies: 4
    Last Post: 09-28-2010, 12:32 PM
  3. Calculating difference between working days?
    By mccrimmon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-16-2007, 08:33 AM
  4. Calculating time difference between two days capturing the overnight time.
    By Monica_La in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-08-2007, 11:22 AM
  5. Formula Help - Time Difference in Days, Hours Mins & Seconds
    By Shashi Bhosale in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2006, 05:10 PM

Tags for this Thread

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