+ Reply to Thread
Results 1 to 3 of 3

Time Difference Between 2 Dates

  1. #1
    Registered User
    Join Date
    03-05-2013
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2007
    Posts
    1

    Time Difference Between 2 Dates

    Greetings, I am new to the excel forum so please forgive any breach of protocal

    I am trying to write a formula to determine the number of working hours and minutes between two dates (orders accepted and orders completed). I only want to consider working hours (6:15-3:15) and exclude weekends and holidays.

    Example;
    Accepted 9/20/2012 3:36 PM
    Completed 9/24/2012 7:07 AM

    This order was accepted after the close of business for us so the answer should be 9.867 hours (9 hours for 9/21 and .867 hours for 9/24).

    I found a formula from a thread a couple of years ago, but I must be doing something wrong in applying it to my situation
    =(17-HOUR(A2)+(MINUTE(A2)/60))+((NETWORKDAYS(A2,B2,"3/7/2011")-2)*8.5) + (HOUR(B2)+(MINUTE(B2)/60) - 8.5)

    If some can help it would be much appreciated. I have over 30,000 rows of data to make this calculation for

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Time Difference Between 2 Dates

    This is not the complete solution for your query, just an idea

    In A1 cell
    9/20/2012 3:36 PM

    In B1 cell
    9/24/2012 7:07 AM

    In C1 cell
    =TEXT(B1-A1,"[h]:mm:ss")

    The above formula will get the total number of hours between two date's and after that you calculate the number of holidays and the based on that get the number of non working hours and subtract it from the total working hours


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Time Difference Between 2 Dates

    TRy this formula

    =24*((NETWORKDAYS(A2,B2)-1)*("15:15"-"6:15")+IF(NETWORKDAYS(B2,B2),MEDIAN(MOD(B2,1),"6:15","15:15"),"15:15")-MEDIAN(NETWORKDAYS(A2,A2)*MOD(A2,1),"6:15","15:15"))

    format result cell as number

    If you want to exclude holidays then you need to add the holiday range to each of the 3 NETWORKDAYS functions
    Audere est facere

+ 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