What is the formula to return the 15th day of the previous month, BUT if that day is on a weekend, to instead return the most recent weekday before it?

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered
EXAMPLE 1 - If today's date is September 23, 2015 then I want the formula to return Friday August 14, 2015 instead of Saturday August 15, 2015.

EXAMPLE 2 - If today's date was January 8, 2016 then I want the formula to return December 15, 2015.


The following formula returns the 15th day of the previous month, but I need to add in the weekend/weekday condition:
var Date LastMonthToday = AdjustMonth(Today(), -1);
Date(Year($LastMonthToday), Month($LastMonthToday), 15)


Thanks
Photo of Robin CC

Robin CC

  • 200 Points 100 badge 2x thumb

Posted 4 years ago

  • 0
  • 1
Photo of Robin CC

Robin CC

  • 200 Points 100 badge 2x thumb
I figured it out.  Here is the formula:


var Date LastMonthToday =  AdjustMonth(Today(), -1);

ToWeekdayP(Date(Year($LastMonthToday), Month($LastMonthToday),15))