+ Reply to Thread
Results 1 to 6 of 6

Thread: Calculate time between dates [only work hours??]

  1. #1
    Registered User
    Join Date
    10-05-2011
    Location
    Veenendaal, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Question Calculate time between dates [only work hours??]

    Hi guys,

    I know how to calculate time between 2 dates.

    But know i need to calculate 2 dates with the result that it calculates the work hours that has been passed...

    I'm not sure if this is possible, i have been googling but didn't find a solution.

    Hope one of you guys know a solution

    Thanks in advice!
    Last edited by romperstomper; 11-03-2011 at 09:12 AM.

  2. #2
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,214

    Re: Calculate time between dates [only work hours??]

    The function NETWORKDAYS() will give you the number of "workdays" between to given dates. Use that, and multiply the days by the number of hours in your workday.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    10-05-2011
    Location
    Veenendaal, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Calculate time between dates [only work hours??]

    Hi JBeaucaire,

    I don't really understand. Please have a look at my results

    Start date: 2-01-09 12:12
    End date: 2-01-09 12:47

    Result Networkdays: 1
    Workhours: 8,5

    Result: 8,5

    Am i doing something wrong?

  4. #4
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,214

    Re: Calculate time between dates [only work hours??]

    Yeah, your sample question was unclear, your second post is clearer. You can't do calcs like that over multiple days without providing more info to the formula about what your workday hours normally are.

    See the attached for a suggestion.
    Attached Files Attached Files
    Last edited by JBeaucaire; 11-03-2011 at 09:27 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    10-05-2011
    Location
    Veenendaal, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Calculate time between dates [only work hours??]

    You are the best!!! Thanks! and excuses for the confusion!

  6. #6
    Forum Moderator daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2007
    Posts
    10,052

    Re: Calculate time between dates [only work hours??]

    Assuming start and end times/dates are within work hours then formula should be sufficient to give you decimal work hours

    =(NETWORKDAYS(A2,B2)-1)*G$2+(MOD(B2,1)-MOD(A2,1))*24

    where G2 contains the daily hours
    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.2.0