# Discussions

View Only

## Last Friday of the Current Month

• #### 1.  Last Friday of the Current Month

Posted 07-12-2021 11:13
I am needing help in finding a formula for a Formula-Date field to show the last Friday of the Current Month by default when adding a record.  I appreciate any help with this!

------------------------------
Tanya Hammil
------------------------------

• #### 2.  RE: Last Friday of the Current Month

Posted 07-12-2021 11:37
Try this as a formula date field, and then have a form rule that says if your date field is blank to make it be the value in this field.

var date LDOM = LastDayOfMonth(today());

var number DaysToBackUp = IF(
DayOfweek(\$LDOM)=5,0,
DayOfweek(\$LDOM-days(1))=5,1,
DayOfweek(\$LDOM-days(2))=5,2,
DayOfweek(\$LDOM-days(3))=5,3,
DayOfweek(\$LDOM-days(4))=5,4,
DayOfweek(\$LDOM-days(5))=5,5,
DayOfweek(\$LDOM-days(6))=5,6);

\$LDOM - Days(\$DaysToBackUp)

------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------

• #### 3.  RE: Last Friday of the Current Month

Posted 07-12-2021 12:12
This worked perfectly!  Thank you very much!

------------------------------
Tanya Hammil
------------------------------

• #### 4.  RE: Last Friday of the Current Month

Posted 18 days ago
I ran across this while looking for something else.  Here's an alternative:

If(DayOfWeek(LastDayOfMonth([Today()])) = 5, LastDayOfMonth([Today()]), PrevDayOfWeek(LastDayOfMonth([Today()]), 5))

------------------------------
Paul Peterson
------------------------------