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
dRidRi 

Formula to calculate the next working day from a given date?

Hi all,

 

I would like to ask for your assistance building a formula that calculates the next working day from a given date.

 

Example: A record created on Sunday should return the date of the following Monday (if created today 19/02) the field should return 20/02.

 

For what I require I also need another field to return the second day after the given date but I suppose that from the first formula I will figure out the second one.

 

Any idea on this?

 

Thanks a lot in advance!

Best Answer chosen by Admin (Salesforce Developers) 
dRidRi

Hi all, this is the solution:

 

 

CASE(
MOD( CloseDate- DATE(1900, 1, 7), 7),
0, CloseDate+1, /*if CloseDate is Sun,CloseDate+1=Monday */
1, CloseDate+1, /*if CloseDate is Mon,CloseDate+1=Tuesday */
2, CloseDate+1, /*if CloseDate is Tues,CloseDate+1=Wednesday */
3, CloseDate+1, /*if CloseDate is Wed,CloseDate+1=Thursday*/
4, CloseDate+1, /*if CloseDate is Thurs,CloseDate+1=Friday */
5,CloseDate+3, /*if CloseDate is Fri,CloseDate+3=Monday next week */
6,CloseDate+2, /*if CloseDate is Sat,CloseDate+2=Monday next week */

CloseDate)

 

:)

All Answers

Navatar_DbSupNavatar_DbSup

Hi,

 

You can create a formula field with the Date type and Use TODAY() +1 in formula field.

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

dRidRi

Hi Navatar,

 

thanks but is not what I'm looking for. Let me explain it with more detail.

 

First I need it to be a non changing value, and using Today() the result will change as soon as I enter the record a different day.

Second I need to differentiate if the following day is a working day or not. If not it will be solved by using Created-Date + 1.

 

Let me show a couple of additional examples:

For a record created today 20/02 the field should show 21/02.

For a record created two days ago, Saturday 18/02, the field should show 20/02.

For a record created one day ago, Sunday 19/02, the field should show 20/02.

 

In short what I need is a field showing the next business day (skipping Saturday and Sunday) after a record is created.

 

Thanks a lot by the way, any input is appreciated.

dRidRi

Hi all, this is the solution:

 

 

CASE(
MOD( CloseDate- DATE(1900, 1, 7), 7),
0, CloseDate+1, /*if CloseDate is Sun,CloseDate+1=Monday */
1, CloseDate+1, /*if CloseDate is Mon,CloseDate+1=Tuesday */
2, CloseDate+1, /*if CloseDate is Tues,CloseDate+1=Wednesday */
3, CloseDate+1, /*if CloseDate is Wed,CloseDate+1=Thursday*/
4, CloseDate+1, /*if CloseDate is Thurs,CloseDate+1=Friday */
5,CloseDate+3, /*if CloseDate is Fri,CloseDate+3=Monday next week */
6,CloseDate+2, /*if CloseDate is Sat,CloseDate+2=Monday next week */

CloseDate)

 

:)

This was selected as the best answer