Observed Holidays UDF

brncao

Board Regular
Joined
Apr 28, 2015
Messages
147
There's a guide for how to create a table with holidays in them, and the only input the users need is Year, which the functions will determine what the holiday date is. However, I want to do away with the table and go with a UDF approach. The only argument that is required would be the year.

I would like the UDF to take the year argument, and produce an array of "Observed" holidays; the function will return an array of dates.

It will be used in this WORKDAY function:
Code:
=WORKDAY(B1,1,OBSHOLIDAYS(year))
Is there something like this out there?
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Which holidays are observed varies from country to country and even within a country.

You could write you own UDF something like

Code:
Function ObsHolidays(year as Long) As Variant
    Dim Result(1 to 12) As Date

    Result(1) = DateValue("1/1/" & Year)
    Result(2) = DateValue("1/16/" & Year)
    '...
    Result(12) = DateValue("12/25/" & Year)

    ObsHolidays = Result
End Function
 
Upvote 0

Forum statistics

Threads
1,202,989
Messages
6,052,945
Members
444,620
Latest member
marialewis16

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