# Quickbase formula for Last WorkDay of a month

• 0
• Question
• Updated 4 years ago
• 348 Points

Posted 4 years ago

• 0
• 75,094 Points
This seems to work. The field [test last day of month - date] is any date.

WeekdayAdd(LastDayOfMonth([test last day of month - date]),0)

• 348 Points
Thanks so much for responding but If the last day of the month is a weekend day it goes to the NEXT weekday - which is in the following month.  I need it go go back to the last workday - or the previous friday.
• 348 Points
I tried this and it seemed to work!  WeekdayAdd(LastDayOfMonth([For Month Beginning]),-1)

Thanks so much Mark!  Could not have gotten it without your help!
• 75,094 Points
You should test a few  dates, I think that subtracting 1 will give you a Thursday if the last date of the month was a Friday.  That is why i subtracted zero days.
• 75,094 Points
Oh, now I just read your previous comment.  I think the final formula still needs some work to get it to work on all cases.
• 348 Points
You are right.  Sigh....
• 75,094 Points
Try this, it subtracts a day only if it has to - ire the last day of the month is on a weekend.

var number DayOfWeekLastdayOfMonth= DayOfWeek([test last day of month - date]);

var number DaysToAdjust = If(\$DayOfWeekLastdayOfMonth=6 or \$DayOfWeekLastdayOfMonth=0,-1,0);