Counting holidays

mfleuette

New Member
Joined
Sep 18, 2002
Messages
27
I searched this forum but was unable to find relevant threads, so I am posting here in the hope that someone out there can help with this problem.

I have an application that requires me to take holiday schedules into account when calculating NETWORKDAYS between a startdate and an enddate

If I had only one holiday schedule to work with, I could use NETWORKDAYS with a named range for the HolidayList

However, I have multiple global locations to consider (e.g. New York, Paris)

Q1: How would one construct a holiday range for NETWORKDAYS such that the location could be taken into effect (i.e. create two named ranges (New_York_Holidays, Paris_Holidays) and parse into cell formula?
pseudo_code = NETWORKDAYS(startdate, enddate, locationName&"_Holidays")

If unable to use method proposed in Q1, then a function would need to be written to count the number of rows in the HolidayList range that fell within a given date range for a given location. The holiday list currently looks like:

Year Holiday Date New York Paris
2008 New Years Day 1/1/2008 X X
2008 Independence Day 7/4/2008 X
2008 Bastille Day 7/14/2008 X
2008 Christmas 12/25/2008 X X

The function would return 2 for (1/1/2008,7/10/2008, New_York_Holidays) and
1 for (1/1/2008, 7/10/2008, Paris_Holidays)

Q2: Is there a better way to structure the holiday data that would make it simpler to count rows?

Q3: If the above sample data were a named range (e.g. HolidaysList) how would it be referenced in a function CountHolidays(start, end, location) in order to count the relevant rows?

Any and all help on this issue is greatly appreciated -

Mike
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Using your Psudocode, for the named ranges method, you need indirect

=NETWORKDAYS(startdate, enddate, INDIRECT(A1&"_Holidays"))

Where A1 is a designated cell to put the location in (New_York_,Paris_,etc)

Hope that helps...
 
Upvote 0

Forum statistics

Threads
1,215,446
Messages
6,124,904
Members
449,194
Latest member
JayEggleton

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