phone: (540)338-0194
email: ken@kenhamady.com

´╗┐

 Crystal Reports formula examples

How to Find the number of Fridays in a date range (or any other day of the week):

The following formula will allow you to count the number of Fridays in any date range.  Your input dates can be database fields, formula fields or parameter fields.  The Input Dates goes in place of {StartDate} and {EndDate} .   You can change the formula to count another day of the week by changing the number 6 to any number from 1 to 7.  Use 1 for Sunday and 7 for Saturday, etc. 

Note 
- You should subtract one day from the start date if you want date ranges that start on Friday to include that first Friday in your count.   In other words if an 8 day range from Friday to Friday should count 2 Fridays.


    DateDiff ( 'ww' , {StartDate} - 1 , {EndDate} , 6  )