Count workdays between the first and last dates in a table column.

vanwooten

Board Regular
Joined
Dec 15, 2020
Messages
60
Office Version
  1. 365
Platform
  1. Windows
I have a Trades table and it has a date column - Trades[Date]. The dates are sequential from top to bottom. Looking for a formula to use outside of the table that will return the number of workdays in the Date column.
 
Try:
Excel Formula:
=NETWORKDAYS.INTL(SUBTOTAL(105,Trades[Date]),SUBTOTAL(104,Trades[Date]))
Excellent use of the Subtotal, Cubist. (y)

I was trying the "filtered" data approach last night, but had no success. An online search results; AI proposed using NETWORKDAYS as usual, and the Subtotal in the Holidays portion of the formula. That was rejected by Excel of course.

I never even thought of using the Subtotal function versions of MIN and MAX. I learned something new and useful! (y)
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Thank you for this. It is the solution for the entire column. I wonder if anyone will come up with a way to the count the networkdays from a filtered data set.
Cubist provided the perfect solution for you. See his post. I was testing it with your original Samle Data and it produces the correct results, even when you apply a filter to the Date column.

One thing to note is there are two versions of the function used: NETWORKDAYS and NETWORKDAYS.INTL

I live in the U.S., so use the former. The differences are exlained here: Excel WORKDAY and NETWORKDAYS functions to calculate working days
Best regards,
 
Upvote 0
Final with Weekend and Holidays thru 2030:

Excel Formula:
=NETWORKDAYS.INTL(SUBTOTAL(105,Trades[Date]),SUBTOTAL(104,Trades[Date]),1,V6:V82)
 
Upvote 0
Final with Weekend and Holidays thru 2030:

Excel Formula:
=NETWORKDAYS.INTL(SUBTOTAL(105,Trades[Date]),SUBTOTAL(104,Trades[Date]),1,V6:V82)
Looks like you got yourself a pretty solid solution. One thing I would recommend is formatting your list of blackout dates (Holidays) as a Table so you don't run into any issues as that list grows/shrinks.
VBA Testing.xlsm
D
1Date
22024-12-24
32024-12-25
42025-01-01
Count

EX: Holidays[Date]
Then you can update your formula from ... V6:V82 to...
Excel Formula:
=NETWORKDAYS.INTL(SUBTOTAL(105,Trades[Date]),SUBTOTAL(104,Trades[Date]),1,[I]Holidays[Date][/I])
 

Attachments

  • 1735943270755.png
    1735943270755.png
    2.6 KB · Views: 3
Upvote 0

Forum statistics

Threads
1,225,623
Messages
6,186,065
Members
453,336
Latest member
Excelnoob223

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