Juggler_IN
Active Member
- Joined
- Nov 19, 2014
- Messages
- 349
- Office Version
- 2003 or older
- Platform
- Windows
I have figured out how to code the Absolute Week in a Year for a given date. How can this be modified to Absolute Week in a Month for a given date? For example, 1st September is Wk 35 and 2nd till 8th September is Wk 36 (absolute weeks with Wk 1 starting on a Wednesday = 1/1/2020).
An Absolute Week counts weeks starting from January 1st, no matter what day of the week it is. In other words, January 1st through 7th is always week one. If January 1st is a Tuesday, than each week of the year will be Tuesday through Monday and tallied accordingly.
An Absolute Week counts weeks starting from January 1st, no matter what day of the week it is. In other words, January 1st through 7th is always week one. If January 1st is a Tuesday, than each week of the year will be Tuesday through Monday and tallied accordingly.
VBA Code:
Public Function AbsWk(x As Date) As Integer
AbsWk = VBA.Int(((x - VBA.DateSerial(VBA.Year(x), 1&, 0&)) + 6&) / 7&)
End Function