Hello! I am trying to create a formula to measure the time in hours/mins) between 2 dates/times, excluding weekends and only counting between 9am - 5pm on a workday.

=(NETWORKDAYS(C2,D2,Holiday_List)-1)*(Day_End-Day_Start)+IF(NETWORKDAYS(D2,D2,Holiday_List),MEDIAN(MOD(D2,1),Day_End,Day_Start),Day_End)-MEDIAN(NETWORKDAYS(C2,C2,Holiday_List)*MOD(C2,1),Day_End,Day_Start)
Where:
C2 = Start/Create Date/Time
D2 = End/Assigned Date/Time

This formula works perfectly assuming that Saturday and Sunday are the only weekend days. however in other parts of the world the weekend can be Friday/Saturday or Thursday/Friday so I need a formula that can account for this.

I have tried this one but it does not work:
=SUMPRODUCT(INT((WEEKDAY(A2-F$2:F$8)+INT(B2)-INT(A2))/7),H$2:H$8-G$2:G$8)-MOD(A2,1)+MOD(B2,1)-LOOKUP(WEEKDAY(B2),F$2:H$8)+LOOKUP(WEEKDAY(A2),F$2:G$8)
where:
A2 = start date / time
B2 = end date / time
C2 = difference
F2..F8 = weekday 1 Sun - 7 Sat
G3..G8 = start times for Mon-Sat
H3..H8 = end times for Mon-Sat


How can I measure the difference between dates and times so that a work day is from 9am - 5pm and the weekend can be changed based on world region?

I hope that you can help!!