Spreadsheet: 693425d1598966702-count-office-and-non-office-hour-between-dates-excel-example_v2
Sheet: Sheet1

 | Engineer Onsite Date | Engineer Onsite Time | Engineer Offsite Date | Engineer Offsite Time | No of Office Hours * | No of Non-Office Hours * |  | Office Hour Definition | In | out
Example 1 - Sep 5 is Weekend (SAT) | 2020-09-04 00:00:00 | 17:30:00 | 2020-09-05 00:00:00 | 01:30:00 |  |  |  | Monday to Friday, 09:00 - 18:00 | 09:00:00 | 18:00:00
Example 2 - Oct 1 is Public Holiday | 2020-10-01 00:00:00 | 16:00:00 | 2020-10-01 00:00:00 | 17:30:00
Example 3 - Across Weekdays & Weekend | 2020-09-25 00:00:00 | 17:00:00 | 2020-09-28 00:00:00 | 02:30:00
 |  |  |  | Correct Answer for Example 3 -> | 1 |  |  | Non Office Hour Definition
 |  |  |  |  |  |  |  | Monday to Friday, other than above working hours
 |  |  |  |  |  |  |  | Anytime in Saturday and Sunday
 |  |  |  |  |  |  |  | Public Holiday as below:
 |  |  |  |  |  |  |  | Jan 1, 2020 | 2020-01-01 00:00:00
 |  |  |  |  |  |  |  | Jan 25, 2020 | 2020-01-25 00:00:00
 |  |  |  |  |  |  |  | Jan 26, 2020 | 2020-01-26 00:00:00
 |  |  |  |  |  |  |  | Jan 27, 2020 | 2020-01-27 00:00:00
 |  |  |  |  |  |  |  | Jan 28, 2020 | 2020-01-28 00:00:00
 |  |  |  |  |  |  |  | Apr 4, 2020 | 2020-04-04 00:00:00
 |  |  |  |  |  |  |  | Apr 10, 2020 | 2020-04-10 00:00:00
 |  |  |  |  |  |  |  | Apr 11, 2020 | 2020-04-11 00:00:00
 |  |  |  |  |  |  |  | Apr 13, 2020 | 2020-04-13 00:00:00
 |  |  |  |  |  |  |  | Apr 30, 2020 | 2020-04-30 00:00:00
 |  |  |  |  |  |  |  | May 1, 2020 | 2020-05-01 00:00:00
 |  |  |  |  |  |  |  | Jun 25, 2020 | 2020-06-25 00:00:00
 |  |  |  |  |  |  |  | Jul 1, 2020 | 2020-07-01 00:00:00
 |  |  |  |  |  |  |  | Oct 1, 2020 | 2020-10-01 00:00:00
 |  |  |  |  |  |  |  | Oct 2, 2020 | 2020-10-02 00:00:00
 |  |  |  |  |  |  |  | Oct 26, 2020 | 2020-10-26 00:00:00
 |  |  |  |  |  |  |  | Dec 25, 2020 | 2020-12-25 00:00:00
 |  |  |  |  |  |  |  | Dec 26, 2020 | 2020-12-26 00:00:00
!!! SUPER CHALLENGING !!!
 | Engineer Onsite Date | Engineer Onsite Time | Engineer Offsite Date | Engineer Offsite Time | No of Office Hours * | No of Non-Office Hours * |  | Office Hour Definition | In | out
Example 4 - Sep 5 is Weekend (SAT) | 2020-09-04 00:00:00 | 17:30:00 | 2020-09-05 00:00:00 | 01:30:00 | 0.5 | 7.5 |  | Monday to Friday, 09:00 - 18:00 | 09:00:00 | 18:00:00
Example 5 - Oct 1 is Public Holiday | 2020-10-01 00:00:00 | 16:00:00 | 2020-10-01 00:00:00 | 17:30:00 | 0 | 1.5 |  | Saturday | 09:00:00 | 13:00:00
Example 6 - Across Weekdays & Weekend | 2020-09-25 00:00:00 | 17:00:00 | 2020-09-28 00:00:00 | 02:30:00 | 5 | 52.5
 |  |  |  |  |  |  |  | Non Office Hour Definition
 |  |  |  |  |  |  |  | Monday to Saturday, other than above working hours
 |  |  |  |  |  |  |  | Sunday
 |  |  |  |  |  |  |  | Public Holiday as below:
 |  |  |  |  |  |  |  | Jan 1, 2020 | 2020-01-01 00:00:00
 |  |  |  |  |  |  |  | Jan 25, 2020 | 2020-01-25 00:00:00
 |  |  |  |  |  |  |  | Jan 26, 2020 | 2020-01-26 00:00:00
 |  |  |  |  |  |  |  | Jan 27, 2020 | 2020-01-27 00:00:00
 |  |  |  |  |  |  |  | Jan 28, 2020 | 2020-01-28 00:00:00
 |  |  |  |  |  |  |  | Apr 4, 2020 | 2020-04-04 00:00:00
 |  |  |  |  |  |  |  | Apr 10, 2020 | 2020-04-10 00:00:00
 |  |  |  |  |  |  |  | Apr 11, 2020 | 2020-04-11 00:00:00
 |  |  |  |  |  |  |  | Apr 13, 2020 | 2020-04-13 00:00:00
 |  |  |  |  |  |  |  | Apr 30, 2020 | 2020-04-30 00:00:00
 |  |  |  |  |  |  |  | May 1, 2020 | 2020-05-01 00:00:00
 |  |  |  |  |  |  |  | Jun 25, 2020 | 2020-06-25 00:00:00
 |  |  |  |  |  |  |  | Jul 1, 2020 | 2020-07-01 00:00:00
 |  |  |  |  |  |  |  | Oct 1, 2020 | 2020-10-01 00:00:00
 |  |  |  |  |  |  |  | Oct 2, 2020 | 2020-10-02 00:00:00
 |  |  |  |  |  |  |  | Oct 26, 2020 | 2020-10-26 00:00:00
 |  |  |  |  |  |  |  | Dec 25, 2020 | 2020-12-25 00:00:00
 |  |  |  |  |  |  |  | Dec 26, 2020 | 2020-12-26 00:00:00