Good morning all, I'm trying to find the number of business hours/minutes between two dates.
However, not only do I have a non-standard schedule, the business hours change from customer to customer. Therefore I'm trying to find the most efficient way to do this, whilst also future proofing should one of the customers choose to change their service hours.
My example data looks like the below:
MrHolte Example Data.JPG
- I want to count the time in minutes or hours between each of the "Open" & "Resolution" dates in my "Data Table" - But only the time the business was open to that customer.
- If there is no "Resolution" date, then that row is still open and should therefore be substituted with NOW()
Using the NETWORKDAYS.INTL formula I can pass through my variable schedule dependant on the customer, however that will only count the number of business days between the two dates, and not the time.
If the business was open the same number of hours each day then I could just multiply the result by the hours per day, only the hours per day vary, so it isn't that simple.![]()
Please Login or Register to view this content.
Example1:
Customer - Account 1
Open Date - Monday 21/06/2021 17:08
Business Hours on Open Date: 08:00 - 18:00
Resolution Date - Monday 28/06/2021 16:45
Business Hours on Resolution Date: 08:00 - 18:00
- 52 minutes between open time and close of business
- Tuesday 08:00 - 18:00 = 10 hours
- Wednesday 08:00 - 18:00 = 10 hours
- Thursday 08:00 - 18:00 = 10 hours
- Friday 08:00 - 18:00 = 10 hours
- Saturday - Closed to customer
- Sunday - Closed to customer
- 8h 45m between start of business & the resolution time
- Total business hours between "Open" & "Resolution" = 49 h 37m
Example2:
Customer - Account 1
Open Date - Sunday 27/06/2021 07:48
Business Hours on Open Date: Closed
Resolution Date - Tuesday 29/06/2021 09:09
Business Hours on Resolution Date: 08:00 - 18:00
- No minutes on open date as the business was closed to customer
- Monday 08:00 - 18:00 = 10 hours
- 1h 9m between start of business & the resolution time
- Total business hours between "Open" & "Resolution" = 11 h 9m
I think I could work this out if it the business hours per day were all the same - it probably wouldn't be pretty, and would involve a lot of nested IFS - but I could get there. As it stands, I have no idea how to sum the number of business hours for each of the network days.
Does anyone have any efficient proposed solutions?
Thank you in advance and I'm very much looking forward to seeing what you come up with.
Bookmarks