## How to calculate net work hours between two dates excluding weekends or holidays in Excel?

In many companies, staff are paid by working hours. To calculate the net work hours in a day is easy, but how about calculating net hours in a date range? For that, this article, introduces the formulas on calculating the net work hours between two dates excluding weekends and holidays in Excel.

Calculate workday exclude weekends

Calculate working hours exclude weekends/holidays

#### Calculate workday exclude weekends

In this part, I introduce the formula to calculate workday between two date times excluding weekends.

1. Select two cells which you will input the start date time and end date time, and right click to select Format Cells form the context menu. See screenshot:

2. In the Format Cells dialog, click Number tab, and select Custom form the Category list, and enter m/d/yyyy h:mm into the Type textbox in right section. See screenshot:

3. Click OK. And enter the start date time and end date time into the two cells separately. See screenshot:

4. In the cell next to these two cells, C13, for instance, enter this formula =NETWORKDAYS(A13,B13)-1-MOD(A13,1)+MOD(B13,1), and press Enter key, and you will get the result with custom format, select the result cell, and click Home tab, and go to the Number Format list to select General to format it as the correct format. See screenshot:

#### Calculate working hours exclude weekends/holidays

If you want to calculate the net working hours excluding weekends or holidays, you can do as bellow:

Calculate net working hours exclude weekends

1. Select two cells and format them as custom format m/d/yyyy h:mm, and enter the start date time and end date time. See screenshot:

2. And in the next to cell, C2 for instance, enter this formula,
=(NETWORKDAYS(A2,B2)-1)*("17:30"-"8:30")+IF(NETWORKDAYS(B2,B2),MEDIAN(MOD(B2,1),"17:30","8:30"),"17:30")-MEDIAN(NETWORKDAYS(A2,A2)*MOD(A2,1),"17:30","8:30"),
press Enter key, then you get a number string. See screenshot:

3. Right click at the number string, and click Format Cells from context menu, and in Format Cells dialog, select Custom form Category list under Number tab, and enter this [h]:mm into Type textbox. See screenshot:

4. Click OK. Now the net working hours between two dates excluding weekends are counted.

Tip: In the formula, A2 is the start date time, B2 is the end date time, 8:30 and 17:30 are the general start time and end time in each day, you can change them as you need.

Calculate net working hours excluding weekend and holidays

1. As the same as above, select two cells and format them as custom format m/d/yyyy h:mm, and enter the start date time and end date time.

2. Select a blank cell, and enter the holiday date into it, here I have 3 holidays and I type them separately in H1:H3. See screenshot:

3. Select a blank cell which will place the counted result, C2 for instance,
=(NETWORKDAYS.INTL(A2,B2,11,H\$1:H\$3)-1)*("17:30"-"8:30")+IF(NETWORKDAYS.INTL(B2,B2,11,H\$1:H\$3),MEDIAN(MOD(B2,1),"8:30","17:30"),"17:30")-MEDIAN(NETWORKDAYS.INTL(A2,A2,11,H\$1:H\$3)*MOD(A2,1),"8:30","17:30"),
and press Enter key, you will get a number string, and format it as custom format [h]:mm. See screenshot:

Tip: In the formula, A2 is the start date time, B2 is the end date time, 8:30 and 17:30 are the general start time and end time in each day, H1:H3 is the holiday cells, you can change them as you need.

#### Easily add days/years/month/hours/minutes/seconds to a datetime in Excel

Supposing you have a date time format data in a cell, and now you need to add a number of days, years, months, hours, minutes, or seconds to this date. Normally, using formula is the first method for all Excel users, but it’s hard to remember all formulas. With Kutools for Excel’s Date & Time Helper utility, you can easily add days, years, months, or hours, minutes or seconds to a date time, moreover, you can caculate the date difference, or the age based on a given birthday without remembering the formula at all. Click for full-featured free trial in 30 days!

### Best Office Productivity Tools

 🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions… Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ... Super Lookup: Multiple Criteria VLookup  |   Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup .... Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List .... Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ... Featured Features: Grid Focus   |  Design View   |   Big Formula Bar   |  Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells   |  Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ... Top 15 Toolsets:  12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

#### Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

• Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
• Open and create multiple documents in new tabs of the same window, rather than in new windows.
• Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi , thank you for the formula, it really helped me in working out hours but my team works 10 hours a day only weekdays from 8am - 6pm , but i have a question , if i work 10 hours a day ,it means i am working 5 days (50 hours) . Pleae find the sample data below.

TASK-1 01/14/2022 19:18:25 01/14/2022 19:18:25 Days:0 Hours:0 Minutes:0 Seconds:0 0 : 0 : 0 : 0 0:00:00
TASK-2 01/14/2022 19:18:25 01/14/2022 20:20:06 Days:0 Hours:1 Minutes:1 Seconds:41 0 : 1 : 1 : 41 0:00:00
TASK-3 01/14/2022 20:20:06 01/21/2022 15:54:47 Days:6 Hours:19 Minutes:34 Seconds:41 6 : 19 : 34 : 41 47:54:47
TASK-4 01/21/2022 15:54:47 01/21/2022 16:21:24 Days:0 Hours:0 Minutes:26 Seconds:37 0 : 0 : 26 : 37 0:26:37
TASK-5 01/21/2022 16:21:24 01/21/2022 17:25:28 Days:0 Hours:1 Minutes:4 Seconds:4 0 : 1 : 4 : 4 1:04:04

0:00:00,0:00,00,47:54:47,0:26:37,1:04:04 -> this the outcome of the formula used (NETWORKDAYS(AA77018,AB77018)-1)*("18:00:00"-"8:00:00")+IF(NETWORKDAYS(AB77018,AB77018),MEDIAN(MOD(AB77018,1),"18:00:00","8:00:00"),"18:00:00")-MEDIAN(NETWORKDAYS(AA77018,AA77018)*MOD(AA77018,1),"18:00:00","8:00:00")

AA... is my Task Arrival Date timestamp, AB... is my Task closer Date timestamp.
i am struggling with extracting days from this. if I work 10 hours a day then 47:54:47 should show me as 4 days 7 hours 54 minutes 47 seconds isn't it?
This comment was minimized by the moderator on the site
This formula is very good. Does anyone know how I can convert this to SQL query?
This comment was minimized by the moderator on the site
it works
This comment was minimized by the moderator on the site
This is very good, what if the shift time spans over 2 days (start time 17:00 to 02:00 next day)
This comment was minimized by the moderator on the site
Hi
Have recieved any update regarding for your questions because I am also finding for same
This comment was minimized by the moderator on the site
Can anyone help me how the formula would be if the work hours are from 8:00 pm to 5:00 am (20:00 to 5:00)?
This comment was minimized by the moderator on the site
Tried the same formula but it's showing negative values.
This comment was minimized by the moderator on the site
Anyone need this formula but for graveyard or night shift schedule?
There are no comments posted here yet