Calculating total number of hours within a period, counting only specific days of the week, and specific time intervals.

Quaichlek

New Member
Joined
Apr 13, 2023
Messages
4
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
I have an existing table with specific cell formatting conventions that I would like to add a column to (column F in this example) that calculates the total number of hours for a specified time span.

For example, using the data in row 3, I want to know how many lecture hours there are if a class takes place on Wednesdays and Fridays from 12:00 PM to 4:00 PM from October 3 until October 31, counting both the start and end date.

Thanks!

20231025_Counting_Hours_Mini-Sheet.xlsx
ABCDEF
1Day(s)Start dateEnd dateStart TimeEnd TimeTotal Hours
2M, T, W, TH, F, S, SUmm/dd/yyyymm/dd/yyyy12:00 AM11:59 PMformula
3W, F10/03/202310/31/202312:00 PM4:00 PM
Hours
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Book1
ABCDEFGHIJK
1Day(s)Start dateEnd dateStart TimeEnd TimeTotal HoursHolidayDateWeekdayNote
2M, T, W, TH, F, S, SUmm/dd/yyyymm/dd/yyyy00.999306formulaNew Year's Day01/01/2023SundayFederal Holiday
3W, F03/10/202331/10/202312:00:0016:00:0024New Year's Day Holiday02/01/2023MondayObserved
4Good Friday07/04/2023FridayFederal Holiday
5Easter Monday10/04/2023MondayFederal Holiday
6Victoria Day22/05/2023MondayFederal Holiday
7Canada Day01/07/2023SaturdayFederal Holiday
8Canada Day Holiday03/07/2023MondayObserved
9Labour Day04/09/2023MondayFederal Holiday
10National Day for 30/09/2023SaturdayFederal Holiday
11Truth and Reconciliation
12National Day for Truth02/10/2023MondayObserved
13and Reconciliation Holiday
14Thanksgiving Day09/10/2023MondayFederal Holiday
15Remembrance Day11/11/2023SaturdayFederal Holiday
16Remembrance Day Holiday13/11/2023MondayObserved
17Christmas Day25/12/2023MondayFederal Holiday
18Boxing Day26/12/2023TuesdayFederal Holiday
Sheet1
Cell Formulas
RangeFormula
F3F3=SUM(DAYS(C3,B3+1)-NETWORKDAYS.INTL(B3,C3,14,I2:I18)+DAYS(C3,B3+1)-NETWORKDAYS.INTL(B3,C3,16,I2:I18))*(E3-D3)*24
 
Upvote 1
try =NETWORKDAYS.INTL(B3,C3,"1101011",I2:I18)*4

=NETWORKDAYS.INTL(B3,C3,"1101011",I2:I18)*(E3-D3)*24
 
Last edited:
Upvote 0
T202310a.xlsm
ABCDEF
1Day(s)Start dateEnd dateStart TimeEnd TimeTotal Hours
2
3W, F3-Oct-2331-Oct-2312:00:0016:00:0032
4d
Cell Formulas
RangeFormula
F3F3=NETWORKDAYS.INTL(B3,C3,"1101011",I2:I16)*(E4-D4)*24
 
Upvote 0
minor edit to formula same result
T202310a.xlsm
ABCDEF
1Day(s)Start dateEnd dateStart TimeEnd TimeTotal Hours
2
3W, F3-Oct-2331-Oct-2312:00:0016:00:0032
4d
Cell Formulas
RangeFormula
F3F3=NETWORKDAYS.INTL(B3,C3,"1101011",I2:I16)*(E3-D3)*24
 
Upvote 0
Solution

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top