Ask Search:
Auren Lopez ShoreAuren Lopez Shore 

How can i calculate the exact date of the next following monday, after today()

I need a salesforce formula that can help me calculate the exact date of the next monday after present day, Thanks

Auren
Best Answer chosen by Miglena (Salesforce.com) 
Dan WoodingDan Wooding
I think this will help you out, it sets Monday as the start of the week. Monday is 0 Tuesday is 1 Wednesday is 2 ect. Then adds the number of days remaining till you get to the next Monday.

CASE(
MOD(TODAY()  - DATE(1900, 1, 8), 7),
0, TODAY() + 7,
1, TODAY() + 6,
2, TODAY() + 5,
3, TODAY() + 4,
4, TODAY() + 3,
5, TODAY() + 2,
6, TODAY() + 1,
DATE(9999,01,01))

All Answers

Dan WoodingDan Wooding
I think this will help you out, it sets Monday as the start of the week. Monday is 0 Tuesday is 1 Wednesday is 2 ect. Then adds the number of days remaining till you get to the next Monday.

CASE(
MOD(TODAY()  - DATE(1900, 1, 8), 7),
0, TODAY() + 7,
1, TODAY() + 6,
2, TODAY() + 5,
3, TODAY() + 4,
4, TODAY() + 3,
5, TODAY() + 2,
6, TODAY() + 1,
DATE(9999,01,01))
This was selected as the best answer
Jon GradmanJon Gradman
Worked like a charm, thanks!