Date Functions
On Wed, 16 Apr 2008 06:54:00 -0700, Sean.rogers
wrote:
Thank you. It work beautifully. One more question. I am self tought in Excel
so can you please explane the Logic in this function?
=A1-6-WEEKDAY(A1-1)
The basic idea is that, with a date in A1, the formula
A1-WEEKDAY(A1) will return the previous Saturday.
Actually, A1-WEEKDAY(A1-DOW) returns the previous Saturday, where DOW = Day Of
Week and Sunday = 1; Saturday = 7. But, of course, WEEKDAY(A1) =
WEEKDAY(A1-7), so both are the same.
DOW becomes important when you want to return a different day than Saturday.
So, to return the Monday of the week befo
=A1-6-WEEKDAY(A1-6-DOW) --
A1-6-WEEKDAY(A1-6-2) --
A1-6-WEEKDAY(A1-8)
Since the weekdays are 1-7 --
A1-6-WEEKDAY(A1-MOD(8,7)) --
A1-6-WEEKDAY(A1-1)
--ron
|