ldLastOfYear = DATE(lnYear, 12, 31) lnWeeksInYear = MAX(WEEK(ldLastOfYear,1,2), WEEK(ldLastOfYear-7,1,2)) lnWeeksPerMonth = MOD(WEEK(GOMONTH(ldFirstOfMonth,1),1,2) + lnWeeksInYear - ; WEEK(ldFirstOfMonth,1,2), lnWeeksInYear)Counting sundays could be simpler in this case though.