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
sandhya santhanagopalansandhya santhanagopalan 

formula field to return corresponding friday's date from any day of the week selected

Hello,
Please help me in writing a formula field which returns the selected weeks friday's date when any day of the week is selected.
Best Answer chosen by sandhya santhanagopalan
Shruti SShruti S
Could you please try this - 
TODAY() + 
CASE(
    MOD(TODAY() - DATE(1900, 1, 7), 7),
    0, 5,
    1, 4,
    2, 3,
    3, 2,
    4, 1,
    5, 0,
    6, 6
    NULL
)
Feel free to ask if you have any more doubts.

All Answers

Shruti SShruti S
Could you please try this - 
TODAY() + 
CASE(
    MOD(TODAY() - DATE(1900, 1, 7), 7),
    0, 5,
    1, 4,
    2, 3,
    3, 2,
    4, 1,
    5, 0,
    6, 6
    NULL
)
Feel free to ask if you have any more doubts.
This was selected as the best answer
sandhya santhanagopalansandhya santhanagopalan
Thanks.let me try and update u.