Is it possible to develop a formula that would count the number of a certain weekday between two dates?

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

For instance, how many Monday's are between 8/15/2016 and Today?  I know you can count the number of weekdays between two dates, but I haven't figured out how to count the number of a particular day.  Obviously if you the dates always only contained complete weeks, then you could divide the total weekdays by 5.  But what if the [Start Date] was a Wednesday and the [End Date] was a Friday?

Photo of Ryan KJ

Ryan KJ

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of Blake Harrison - DataBlender

Blake Harrison - DataBlender, Champion

  • 100 Points 100 badge 2x thumb
I think I would start with figuring out the total number of Weekdays, but change the two dates. Instead of [Start Date], I'd start with LastDayOfWeek([Start Date]). For [End Date], I'd use FirstDayOfWeek([End Date]). Once you have the # of Weekdays, go ahead and divide by 5, like you had mentioned. Then, if DayOfWeek([Start Date])>1, subtract 1. Additionally, if DayOfWeek([End Date])=0, subtract 1.