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
Prasanth SrinivasanPrasanth Srinivasan 

how to calculate the number of specified week day within the date range?

I want to know the number of specified day say(Sun, Mon or Sat) within the specified date range example (11/01/2014 to12/16/2015). Is there any formula to calculate this, such as we pass these two dates as input and get the number of specified day between this date range?. Kindly suggest.
pconpcon
There is not going to be any easy way to do that.  You can do something like get the day of the week [1] for the start and for the end.  Then subtract the two dates and figure the total number of days between.  From that you should be able to divide by 7 to figure out how many weeks.  Given that you should be able to figure out the number of days based on the number of week and then adding the number of remaining days.

[1] https://help.salesforce.com/HTViewHelpDoc?id=formula_using_date_datetime.htm
anto nirmalanto nirmal
Hi Prasanth,

You can use the solution in the knowledge article:
https://help.salesforce.com/HTViewSolution?id=000004526

You can customize the Weekday calculation as per your need.

Let me know if this helps.

As a common practice, if your question is answered, please choose 1 best answer.
Additionally you can give every answer a like if that answer is helpful to you.

Regards,
Anto Nirmal