Forum Discussion

TanyaHammil1's avatar
TanyaHammil1
Qrew Member
4 years ago

Last Friday of the Current Month

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
------------------------------
  • 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
    ------------------------------
    • TanyaHammil1's avatar
      TanyaHammil1
      Qrew Member
      This worked perfectly!  Thank you very much!

      ------------------------------
      Tanya Hammil
      ------------------------------
      • PaulPeterson1's avatar
        PaulPeterson1
        Qrew Assistant Captain
        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
        ------------------------------