Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel function to determine the last Friday in a month

Tags:

datetime

excel

I'm looking for an Excel function to return the last Friday in a month for a given date.

ie: Any date in the month as input will give the date of the last Friday as output.

14-July-09 should give 31-July-09
7-March-05 should give 35-March-09
like image 681
Callum Avatar asked Mar 01 '23 11:03

Callum


1 Answers

Building on @Toomas answer above, I had to make some amendments for Excel 2007, but came up with the following:

=EOMONTH(A1,0)-MOD(WEEKDAY(EOMONTH(A1,0))+1,7)

Which is assuming that the WEEKDAY returned for Friday is 6 and then applying a shifted MOD 7 to achieve the correct day.

like image 143
Component 10 Avatar answered Mar 07 '23 05:03

Component 10