Hi all,
In the beginning I took a pretty similar route as @BrianJ did…
The key, separating specific- from relative holiday dates.
- Retrieving all building blocks/elements
- Assigning a numeric value to count words
- Creating a list of all dates that match: Year, Month and Day name
To be honest it’s not a list at all but a table containing 4 or 5 rows for each relative holiday - If the holiday has a specific date (like New Years) then construct a date value
otherwise return a BLANK - For relative holidays check if we’re looking for the Last occurrence, if so
get the first date value from the ListDates in decending order else
get the n-Occurrence from the ListDates in ascending order - Finally if the result form (4) returns a blank, get the result from (5)
.
For the celebrated on date a simple SWITCH based on the Day of the Week for the Holiday date and then offsetting the Holiday date value by either minus or plus 1.
.
I find it really interesting to see so many different approaches to the same “Problem”.
Loved seeing the PATHITEM being applied here, I’ll be looking for ways to use that
Big thanks to all who participated - even if you were unsuccessful on your first attempt or did not submit, you can evaluate your thought process and/or problem break down and compare it with all solutions that are/will be posted here.
Last but not least I really enjoyed the first POTW - thanks again Brian for making this happen !!!