Solved

day of the year - weekends

Posted on 2006-11-14
3
321 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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 …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

827 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