I need a formula to get me to the first or third specified day of the week of the following year.
So, here is the information I am presented. I have a year (y), a month (m) and a day of the week (n). From those variables I need to find date the next year falls on.
For example lets say we start Wednesday 1/3/2018. I need a formula to get me to the first Wednesday of January 2019 which, looking at a calendar, is 1/2/2019. This needs to apply to all months and days of the week. A second example, say I start on Wednesday 2/7/2018. This formula has to get me to the first Wednesday of February 2019 which, again, looking at a calendar is 2/6/2019.
I have attempted to use Zeller's Rule and refactor to find the date but to no avail. I also found this link:
From here, I tried solving for d. But because of the truncation required I could not.