function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chad RitchieChad Ritchie 

Weekday Formula

Hey guys,

Here's what I have right now: MONTH( TODAY() ) + 1, 1) - 1) - 8),(IF( MONTH( TODAY() ) = 12,
DATE( YEAR( TODAY() ), 12, 31 ),
DATE( YEAR( TODAY() ), MONTH( TODAY() ) + 1, 1) - 1) - 7))

What would the formula look like if instead of just counting 7 days down from the last day of the month, and instead count down 7 business days from the last day of the month?

Thanks!!
Best Answer chosen by Chad Ritchie
Alain CabonAlain Cabon
Do you have some samples (for September, October, November 2018) ?

1) Formula: last_day_month__c:

(DATE( YEAR( date1__c ), MONTH( date1__c ) + 1, 1) - 1)

2) Formula: business_last_day_month_minus_7__c:

CASE( 
MOD( last_day_month__c - DATE( 1900, 1, 8 ), 7 ), 
/* 0, monday, 1, tuesday, 2, wednesday, 3, thursday, 4, friday, 5, saturday, 6, sunday */ 
5, last_day_month__c - 8 - 1, /* previous friday of last day of month (saturday) */ 
6, last_day_month__c - 8 - 2, /* previous friday of last day of month (sunday) */ 
last_day_month__c - 8 
)

3) DATE( 1900, 1, 8 ) = Monday and you use TODAY() instead of date1__c

All Answers

Alain CabonAlain Cabon
Do you have some samples (for September, October, November 2018) ?

1) Formula: last_day_month__c:

(DATE( YEAR( date1__c ), MONTH( date1__c ) + 1, 1) - 1)

2) Formula: business_last_day_month_minus_7__c:

CASE( 
MOD( last_day_month__c - DATE( 1900, 1, 8 ), 7 ), 
/* 0, monday, 1, tuesday, 2, wednesday, 3, thursday, 4, friday, 5, saturday, 6, sunday */ 
5, last_day_month__c - 8 - 1, /* previous friday of last day of month (saturday) */ 
6, last_day_month__c - 8 - 2, /* previous friday of last day of month (sunday) */ 
last_day_month__c - 8 
)

3) DATE( 1900, 1, 8 ) = Monday and you use TODAY() instead of date1__c
This was selected as the best answer
Alain CabonAlain Cabon

The formula for the last day month above is too simple (even if you already had the good version and thas was not your problem)

The fixed formula is this one.

1) Formula: last_day_month__c:

IF(MONTH(date1__c)=12,DATE(YEAR(date1__c)+1,1,1)-1, DATE(YEAR(date1__c),MONTH(date1__c) + 1,1) -1)

or just:

IF(MONTH(date1__c)=12,DATE(YEAR(date1__c),12 ,31), DATE(YEAR(date1__c),MONTH(date1__c) + 1,1) -1)