+ Reply to Thread
Results 1 to 4 of 4

Working Hours between 2 dates (including Saturdays with Diff hours)

  1. #1
    Registered User
    Join Date
    10-06-2012
    Location
    Merseyside, England
    MS-Off Ver
    Excel 2010
    Posts
    7

    Working Hours between 2 dates (including Saturdays with Diff hours)

    Ladies and Gents,

    I'd appreciatesome assistance. Im pulling my hair out after 6 hours of searching and near misses.

    Ultimately I want a formula or VBA function which will count the number of hours between 2 dates/ times (dd/mm/yyyy hh:mm:ss). I can find plenty of info on doing this for weekdays only or for all 7 days or even for weekdays and saturdays with all days having the same hours but not what i need.

    My working hours would be Mon-Fri 07:30 - 22:00
    Sat 08:00 - 18:00

    I want to exclude Sundays and any Holidays. Im happy to use either VBA or formula or amlgamations of more than one formula to get the answer.
    Im currently using the following formula but this formula has all days with the same working hours.

    Please Login or Register  to view this content.
    Any help you can offer would be greatly appreciated.

    Regards

    Ejou

  2. #2
    Valued Forum Contributor Melvinrobb's Avatar
    Join Date
    06-19-2012
    Location
    Manitoba, Canada
    MS-Off Ver
    Excel 2013
    Posts
    1,128

    Re: Working Hours between 2 dates (including Saturdays with Diff hours)

    In order to wrap my head around it, I needed to separate it into 4 calculations
    The number of hours on the start date
    The number of hours on workdays
    The number of hours on Saturdays
    The number of hours on the end date

    I may have some errors in the formulas for unique scenarios, so I would double check.

    Is this useful?
    Attached Files Attached Files
    Please click the * icon below if I have helped.

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

    Re: Working Hours between 2 dates (including Saturdays with Diff hours)

    Will your start/end dates/times always be within the working hours or could they be outside those (e.g. on Sundays, holidays evenings etc.)?
    Audere est facere

  4. #4
    Registered User
    Join Date
    10-06-2012
    Location
    Merseyside, England
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Working Hours between 2 dates (including Saturdays with Diff hours)

    Melvin Robb - Thats great and it certainly works but as you say it is 4 seperate formulae.

    daddylonglegs- They could technically fall outside of those hours but if they did I would have them default to the start of the next "day".


    I have a working formula in a sense now, i essentially doubled up on the above but had 2 holiday lists and 2 sets of day start/day end :
    Please Login or Register  to view this content.
    The red part essentially counts all days and assigns a working day of 07:30 -22:00 but then i have listed all saturdays as my "HolidayList".
    The blue part does the same but with hours 08:00-18:00 and lists all weekdays in the "HolidayListSat"

    This does give me the desired result so feel free to dismiss this if it is a tricky one but I do feel there is a much more elegant way of doing this!

    Cheers

    Ejou

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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