adam rowe
adam rowe

Reputation: 446

find last day of any weekday in month

I am trying to determine if a given date is the last day of that type (Sunday, Monday, Tuesday, etc.) in its month. For example, for March of 2016, the last Friday of the month is the 25th.

Please note I am not trying to figure out what the last day of the month is. Also, 'weekday' in the question refers to any of the 7 days, not just non-weekend days.

I am using excel and php as tags because I can work with either approach.

Upvotes: 0

Views: 144

Answers (1)

Gary's Student
Gary's Student

Reputation: 96791

Just determine how close the given date is to the end of the month. For the given date in A1, use:

=IF(DATE(YEAR(A1),MONTH(A1)+1,0)-A1<7,TRUE,FALSE)

Upvotes: 2

Related Questions