+ Reply to Thread
Results 1 to 2 of 2

Calculate working hours between two date/time fields

  1. #1
    Registered User
    Join Date
    10-11-2007
    Posts
    25

    Calculate working hours between two date/time fields

    Hi,

    I am trying to come up with a formula or custom formula that can perform the following:

    Calculate the difference between a Start Date (Date/Time) and an End Date (Date/Time) but exclude the hours when our business is NOT open. Our opening hours are 08:00 to 18:00 Monday to Friday and 08:00 to 12:00 on Saturday.

    I can do this calculation for Monday to Friday but the Saturday element is tripping me up! I have used the following formula - if anyone can think of a tweak to this to cover the brief that would be ideal as I'd like to share this solution with another business lead and he is reticent to dip into VBA

    =(NETWORKDAYS(StartDT,EndDT,HolidayList)-1)*(DayEnd-DayStart)+MOD(EndDT,1)-MOD(StartDT,1)

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

    Re: Calculate working hours between two date/time fields

    Which version of Excel are you using?

    The formula you quoted works if StartDT and EndDt are always within the working hours, will that always be the case?

    If so then using Excel 2010 or later you can use this version

    =(SUM(NETWORKDAYS.INTL(A2,B2,{1,"1111101"})*{10,4})-IF(WEEKDAY(B2)=7,4,10))/24+MOD(B2,1)-MOD(A2,1)

    where A2 contains start date/time and B2 contains end date/time
    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)

Similar Threads

  1. Calculate start date & time of task (working hours)
    By kaaver in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-30-2016, 10:56 AM
  2. [SOLVED] Calculate time for working hours when start time falls outside of working hours
    By SKDY_Beau in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-20-2014, 12:50 PM
  3. Replies: 1
    Last Post: 09-13-2012, 05:50 AM
  4. Replies: 0
    Last Post: 09-13-2012, 05:28 AM
  5. Replies: 3
    Last Post: 12-23-2010, 04:46 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