I'm calculating the number of payments remaining this year based on the current date and the 1st payment date of a loan. For example, if the loan's first payment date is Oct 31, 2017 (a Tuesday) and the payment is weekly, there's only 1-more payment to the end of this year (Tues Dec 26, 2017). Providing the loan's 1st payment date is in 2017, I can correctly calculate the number of payments remaining on a Monthly, Weekly or BiWeekly basis.

However, if the 1st payment of the loan takes place prior to 2017 (2016, 2015...) I cannot correctly calculate the number of Weekly or Bi-Weekly payments remaining in 2017 (Monthly does work). This is likely due to the fact that I'm using WeekOfYear in my calculation (which works for 2017) and the fact that FM can have more than 52-weeks in a year.

Any ideas on how I should alter the calculation for years prior to the current year? Thanks.

Suggest sharing the calculation that you use now.