Solved

# Crystal Reports need formula that will subtract weekends and holidays from a datediff formula

Posted on 2011-05-12
Medium Priority
989 Views
Need to track the number of days between the Date that a Work Order is requested and Completed. I have a formula that does this.

I have a DaysDifference formula that someone on EE gave me for an aging report. I need to subtract the weekend days and holidays from the number that is returned with the formula above.

Can I adapt the formula that was provided for me for the aging report to this? I included the DaysDifference formula.

Thank you!
``````//@DaysDifference
Global DateVar Array Holidays;
Local NumberVar FullDays;
Local NumberVar BankHolidays;
Local NumberVar Weekends;
Local NumberVar i;
Local DateVar EndDate := Today;

(
//Count the number of full days between dates
Fulldays := DateDiff ('d',StartDate,EndDate);

//Count any holidays between dates
For i := 1 to Ubound(holidays)
Do
If Holidays[i] >= StartDate and Holidays[i] <= EndDate Then
BankHolidays := BankHolidays + 1;

//Count any weekends between dates
Weekends := DateDiff("ww", StartDate, EndDate, crsaturday) +
DateDiff("ww", StartDate, EndDate, crsunday)
);

//Calculate Working days
FullDays - Weekends - BankHolidays
``````
0
Question by:J C
• 2

LVL 101

Accepted Solution

mlmcc earned 2000 total points
ID: 35749932
That formula already subtracts out the holidays and weekends.

Just use the Complete Date field instead of TODAY in the formula.

mlmcc
0

LVL 101

Expert Comment

ID: 35749939
You will need to create a new version of the formula with the changed field.

mlmcc
0

Author Comment

ID: 35750151
Thanks a lot!
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Hi, I am very much excited today since I'm going to share something very exciting Tool used for Analytical Reporting and that's nothing but MICROSTRATEGY. Actually there are lot of other tools available in the market for Reporting Such as Co…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Screencast - Getting to Know the Pipeline
###### Suggested Courses
Course of the Month16 days, 5 hours left to enroll