mad_mickey Posted December 17, 2007 Posted December 17, 2007 Should hopefully be a very quick one here for one of you super clever dudes! Is there a calculation that will give the total number of week days (excluding weekends within a given period?
LaRetta Posted December 17, 2007 Posted December 17, 2007 If ( Date1 and Date2 ) ; Let ( [ spanStart = Date1 - Mod ( Date1 ; 7 ) ; spanEnd = Date2 - Mod ( Date2 ; 7 ) + 6 ; wkndCount = Div ( spanEnd - spanStart + 1 ; 7 ) * 2 - (spanStart < Date1 ) - ( spanEnd > Date2 ) ] ; Date2 - Date1 + 1 - wkndCount ) )
Søren Dyhr Posted December 17, 2007 Posted December 17, 2007 Indeed, but Michael's CF is slightly more flexible: http://www.briandunning.com/cf/452 If you put ValueCount( around it.... it could then be made to deal with regular days off as well! --sd
mad_mickey Posted December 17, 2007 Author Posted December 17, 2007 Tried your calculation replacing date1 and date2 in your calculation with the 'from' and 'to' dates in my database but the first line is coming up with the 'There are too few parameters in this function' message!
Søren Dyhr Posted December 17, 2007 Posted December 17, 2007 Did you call it this way: ValueCount(WeekDaysInRange ( FromDate ; ToDate ; "1¶7" )) : --sd
LaRetta Posted December 17, 2007 Posted December 17, 2007 If ( Date1 and Date2 [color:red]) ; Remove the bracket in red. Soren, I agree Michael's is more flexIble than mine.
comment Posted December 17, 2007 Posted December 17, 2007 I don't think you need to use a recursive calculation for this. If you want the flexibility of being able to select which days are considered weekends, see here: http://www.fmforums.com/forum/showtopic.php?tid/155958/post/156042/#156042
mad_mickey Posted December 18, 2007 Author Posted December 18, 2007 Thanks for everyone's help on this. :beertime
Recommended Posts
This topic is 6245 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now