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
bhanu_prakashbhanu_prakash 

weekend or weekday calcuate

I have created custom field on lead object with 
Forumla return type :text
Using below formula
CASE (MOD (TODAY () - DATE (1900, 1, 7), 7), 0, "Sunday", 1, "Monday", 2, "Tuesday", 3,"Wednesday", 4, "Thursday", 5, "Friday", 6, "Saturday”, “Error",NULL)
But issue is iam getting only TUESDAY as answer . please let me know where Iam wrong .
Thanks in Advance.


 
Best Answer chosen by bhanu_prakash
Dilip_VDilip_V
Hi Bhanu,

We can't use fields in default value formula.Rather modify actual formula defination like this.
CASE (MOD (DATEVALUE( CreatedDate )- DATE (1900, 1, 7), 7), 0, "Weekend", 6, "Weekend", "Weekday")

User-added image

I Tried it it worked.

Let us know if its helpful.

If it's helpful mark it as best answer.

Thanks.
 

All Answers

Dilip_VDilip_V
Hi Bhanu,

If I understood your requirement correctly the formula looks like this.
CASE (MOD (TODAY () - DATE (1900, 1, 7), 7), 0, "Weekend", 6, "Weekend”, “Weekday",NULL)
Please let me know if its useful.

If it's helpful mark it as best answer.

Thanks.
 
sridhar sivaramansridhar sivaraman
That is because TODAY (2nd May 2017) is "Tuesday".
bhanu_prakashbhanu_prakash
Hi,
Thank for your update. I need to find out lead created day is weekday or weekend but it is showing today's day :(
How can i change Today () into lead created date ?
I cannot understand .Please help me
Dilip_VDilip_V
Bhanu,

try this if you want to display weekdate or weekend
CASE (MOD ( CreatedDate - DATE (1900, 1, 7), 7), 0, "Weekend", 6, "Weekend”, “Weekday",NULL)

Try this formula if you want to display day of the week.
 
CASE (MOD ( CreatedDate - DATE (1900, 1, 7), 7), 0, "Sunday", 1, "Monday", 2, "Tuesday", 3,"Wednesday", 4, "Thursday", 5, "Friday", 6, "Saturday”, “Error",NULL)
Let us know if its helpful.

If it's helpful mark it as best answer.

Thanks.
 
bhanu_prakashbhanu_prakash
Hi iam facing below error User-added image
Dilip_VDilip_V
Hi Bhanu,

We can't use fields in default value formula.Rather modify actual formula defination like this.
CASE (MOD (DATEVALUE( CreatedDate )- DATE (1900, 1, 7), 7), 0, "Weekend", 6, "Weekend", "Weekday")

User-added image

I Tried it it worked.

Let us know if its helpful.

If it's helpful mark it as best answer.

Thanks.
 
This was selected as the best answer