Calendar statistics

1. Senior Member
Join Date
Dec 1969
Posts
1,315

Calendar statistics

First: I am new to this!! I need to set up a means of tracking supply orders. It will have to start a timer on orders and account for weekends (holidays not necessary). Does anyone know of some code roughly similar to this?

2. Senior Member
Join Date
Dec 1969
Posts
96,118

RE: Calendar statistics

You mean you simply want to know the number of days from the date of shipment to today? (Or to some other given date, perhaps even the date of arrival?)<BR><BR>Assuming you never ship *OR* arrive on a weekend day, then:<BR><BR>(1) Take the shipping day and "back up" to the preceding Sunday.<BR>(2) Take the arrival/current day and "back up" to the preceding Sunday.<BR>(3) Count the number of weeks from the first Sunday to the other Sunday. Multiply by 5 to get the number of weekdays used.<BR>(4) Adjust that result by the number of days you backed up in both (1) and (2).<BR><BR>SO....<BR><BR>Something like this:<BR><BR>&#060;%<BR>&#039 You get the date fields from somewhere...<BR>date1 = ...<BR>date2 = ...<BR><BR>adjust1 = Weekday( date1 ) - 1 &#039 will be 1 for Monday, 2 for Tuesday, etc.<BR>adjust2 = Weekday( date2 ) - 1 <BR><BR>sun1 = DateAdd( "d", - adjust1, date1 ) &#039 back up to Sunday<BR>sun2 = DateAdd( "d", - adjust2, date2 )<BR><BR>weekdays = 5 * DateDiff( "w", sun1, sun2 ) &#039 5 times number of full weeks<BR><BR>weekdays = weekdays - adjust1 + adjust2 &#039 work it out on a calendar!<BR><BR>%&#062;<BR><BR>Hokay? If you need to handle starting/stopping on a weekend day, it just takes a few IF statements to special case them.<BR><BR>

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•