Solved

day of the year - weekends

Posted on 2006-11-14
3
320 Views
Last Modified: 2008-03-10
I used the days360(#1/1/2006#, maximum({InvMovements.EntryDate})) to get the day of the year.  I need a formula or something to exclude weekends. Any ideas?  

Thanks for any help.
0
Comment
Question by:ThomasBallardIT
  • 2
3 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 17938862
Hi ThomasBallardIT,
You can get the number of workdays between 2 dayes using the formula here:
http://kenhamady.com/form01.shtml

Pete
0
 
LVL 3

Author Comment

by:ThomasBallardIT
ID: 17939284
I don't need to deal with holidays, could you simplify that formula a bit.  
I'm not much at using variables, but if thats the best way then I will do it.
0
 
LVL 77

Accepted Solution

by:
peter57r earned 250 total points
ID: 17939388
I have commented out the lines you don't need.  You can delete them if you wish.
You don't need the Holiday formula at all.

//Main formula
WhileReadingRecords;
Local DateVar Start := {StartDate};   // place your Starting Date here
Local DateVar End := {EndDate};  // place your Ending Date here
Local NumberVar Weeks;
Local NumberVar Days;
//Local Numbervar Hol;
//DateVar Array Holidays;

Weeks:= (Truncate (End - dayofWeek(End) + 1
- (Start - dayofWeek(Start) + 1)) /7 ) * 5;
Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
(if DayOfWeek(Start) = 1 then -1 else 0)  +
(if DayOfWeek(End) = 7 then -1 else 0);  

//Local NumberVar i;
//For i := 1 to Count (Holidays)
//do (if DayOfWeek ( Holidays[i] ) in 2 to 6 and
//    Holidays[i] in start to end then Hol:=Hol+1 );

Weeks + Days
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question