LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Harlan Grove
 
Posts: n/a
Default

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



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"