PDA

View Full Version : Determining if a date meets a criteria



kualjo
08-29-2008, 12:22 PM
I am trying to write a function that returns TRUE if a date meets a certain criteria (is it a holiday?). Some of the dates are specific, such as 7/4. Others are variable, such as the 1st Monday of a month. The specific dates are easy to work with, but I can't figure out a way to write the criteria for the variable dates. How can I get my function to determine if this criteria is met?

Here is a part of the code that works.
If (Month(dates) = 7 And Day(dates) = 4) Then
IsHoliday = True

I can still use the first part:
If (Month(dates) = 7....

I need to make the second part look for a Kth weekday.

Any ideas?

mikerickson
08-29-2008, 12:58 PM
Take a look at http://www.cpearson.com/excel/holidays.htm

Bob Phillips
08-29-2008, 01:34 PM
If Month(dates) = 7 And Weekday(dates) = 3 Then 'Tues