View Single Post
  #7   Report Post  
Lewis Clark
 
Posts: n/a
Default

I apologize for not asking my question more clearly. I did read the whole
response, but I'm still missing some of the logic. If I understand
correctly:

a) The first part of the formula: "A3-DAY(A3)+14" will always return the
date (or more correctly the date serial number) of the 14th of the month
referenced in cell A3.

b) The first part of the weekday function: "A3-DAY(A3)" will reference the
last day of the previous month, which can be any day of the week. This will
always be the same day of the week as the 14th of the current month.

Here's what I don't understand: Since the last day of the previous month
can be any day of the week, I can't figure out how you know in advance what
correction to make with the WkDay term.

Thank you.



"Harlan Grove" wrote in message
oups.com...
Lewis Clark wrote...
I understand most of this formula, except for the number "5" in the
weekday
function. Could someone please explain what purpose it serves? How would
it change if you were looking for the 2nd Tuesday, for example?

...

Reread the *WHOLE* response, especially the final sentence: "The 5 term
in the first 2 formulas corresponds to Wednesday by counting back from
Sunday = 1, so Saturday = 2, etc." So the 2nd Friday would be given by

=A3-DAY(A3)+14-WEEKDAY(A3-DAY(A3)+ 3 ,3)

the 4th Monday by

=A3-DAY(A3)+28-WEEKDAY(A3-DAY(A3)+ 7 ,3)

and the 3rd Sunday by

=A3-DAY(A3)+21-WEEKDAY(A3-DAY(A3)+ 1 ,3)

So in general,

=SomeDate-DAY(SomeDate)+WkNum*7-WEEKDAY(SomeDate-DAY(SomeDate)+ WkDay
,3)

where WkDay is given by the table

1 Sunday
2 Saturday
3 Friday
4 Thursday
5 Wednesday
6 Tuesday
7 Monday