NETWORKDAYS & Holidays with Criteria

zero269

Active Member
Joined
Jan 16, 2023
Messages
253
Office Version
  1. 365
Platform
  1. Windows
Hello,
I'm currently using the following formula to return the number of Weekdays between two dates, excluding dates from another Table.
Excel Formula:
=NETWORKDAYS( [@[Test Date]], t_Period_Active[End Date], t_Event_Dates[[Start Date]:[End Date]])
However, this table has dates that meet two different criteria: Events and Breaks. The ~Breaks indicate No School, while ~Events are open School days.

I'm trying to figure out how to add criteria to the Holiday portion of the formula to only exclude dates where the Category contains "Break".

Any help would be greatly appreciated. Here's my Sample Data using xl2bb:
testdates.xlsx
ABCD
1StartEndCategoryNo School
22024-08-162024-08-16School Event
32024-08-212024-08-21School Event
42024-09-022024-09-02Holiday Break1 day
52024-09-112024-09-11School Event
62024-09-262024-09-30School Break3 days
72024-11-282024-11-29Holiday Break2 days
8
9Testing Ends
102024-12-21
11
12Test DateTest Days
132024-08-1683
142024-08-2181
152024-09-1168
162024-10-0157
172024-12-183
Sheet1
Cell Formulas
RangeFormula
B13:B17B13=NETWORKDAYS( [@[Test Date]],$P$15,t_SchoolSchedule[[Start]:[End]])
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
OK, so I THINK I might have gotten it to work adding a FILTER function. An idea from this video.
Excel Formula:
=NETWORKDAYS( [@[Test Date]],t_Period_Active[End Date],FILTER(t_Event_Dates[[Start Date]:[End Date]], ISNUMBER(SEARCH("break",t_Event_Dates[Category]))))
I just need to test it against a smaller dataset, but when I added a fake Holidy Break for July 16, I noticed JUL 16 & 17 now show 22 days in my original dataset. So that's good news for now.
 
Upvote 0
Solution
Here's my test using my original Sample Data:
Looks good to me I can see the Test Days increasing 3 days to start; 3 Event Dates. (y)
However, I'm am curious if this is truly the best approach and if anyone uses a similar solution.
Thanks...
testdates.xlsx
ABCD
1StartEndCategoryNo School
22024-08-162024-08-16School Event
32024-08-212024-08-21School Event
42024-09-022024-09-02Holiday Break1 day
52024-09-112024-09-11School Event
62024-09-262024-09-30School Break3 days
72024-11-282024-11-29Holiday Break2 days
8
9Testing Ends
102024-12-21
11
12Test DateTest DaysWith Filter
132024-08-168386
142024-08-218183
152024-09-116869
162024-10-015757
172024-12-1833
Sheet1
Cell Formulas
RangeFormula
B13:B17B13=NETWORKDAYS( [@[Test Date]],$P$15,t_SchoolSchedule[[Start]:[End]])
C13:C17C13=NETWORKDAYS( [@[Test Date]],$A$10,FILTER(t_SchoolSchedule[[Start]:[End]], ISNUMBER(SEARCH("break",t_SchoolSchedule[Category]))))
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,082
Members
453,021
Latest member
Justyna P

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