Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Thanks for the help so far guys... I am by no means an expert at Excel, and am only trying to help a friend who owns a body shop. Believe me, he is not guru at computers, but can bring a car back to life Chris Foose. Basically, Progressive Insurance requires that their jobs be completed within a certain "cycle time", based on when the car arrives at the shop and when the repairs are completed. A cycle time of 4.0 or 4.5 is acceptable, but anything below that, and Progressive starts to limit the number of vehicles that are brought to my friends shop for repairs. His business is new, and I am doing all that I can to help him get started. I created one sheet where you input a start date and time and an end date and time. This sheet calculates the cycle time based on "flag hours (the number of hours Progressive estimates that the repairs will take)". I created another sheet where you input a start date and time, desired cycle time, and it will tell you when the vehicle is due to maintain the cycle time that you input in the cell. What I need is to exclude weekend days, and the work hours for the week can include all 24 hours of each day. I only need to exclude weekend days if they fall into the date ranges that are manually added. I did find this VB code on the net, but I have no idea how to use it: '************************************** 'Windows API/Global Declarations for :Ne ' tWorkDays '************************************** - '************************************** ' Name: NetWorkDays ' Description:The code is capable of cal ' culating the NETWORK DAYS LIKE it does i ' n excel. The Weekends gets removed and the days betwwen the 2 dates is the output in days ' By: Brijesh ' ' ' Inputs:this is the function call checkAvailableDays = dayscalculation(CalculationStartDate, WPAEmpEndDate) ' ' Returns:Returns days excluding weekday ' s. Holidays are included....working on a code to remove that ' 'Assumes:- ' 'Side Effects:I dont see any except for ' the error handling which can be customis ' ed 'This code is copyrighted and has limite ' d warranties. 'Please see http://www.Planet-Source-Cod ' e.com/xq/ASP/txtCodeId.64390/lngWId.1/qx ' /vb/scripts/ShowCode.htm 'for details. '************************************** 'call to the function dim checkAvailableDays as integer checkAvailableDays = dayscalculation(CalculationStartDate, WPAEmpEndDate) '---Amazing this code actially works Private Function dayscalculation(CalculationStartDate As Date, WPAEmpEndDate As Date) Dim workingdays As Integer StDateValue = CDate(CalculationStartDate) EndDateValue = CDate(WPAEmpEndDate) If (StDateValue EndDateValue) Then MsgBox "Sorry Invalid Date Value", vbCritical, "VOID" workingdays = 0 Else If (StDateValue = EndDateValue) Then MsgBox "Sorry Dates are Same", vbCritical, "VOID" workingdays = 0 Else workingdays = DateDiffW(StDateValue, EndDateValue) End If End If dayscalculation = workingdays End Function Private Function DateDiffW(StDateValue, EndDateValue) For i = StDateValue To EndDateValue If (Weekday(i) < 1) And (Weekday(i) < 7) Then WorkingDaysValue = WorkingDaysValue + 1 End If Next DateDiffW = WorkingDaysValue End Function If you guys are will to help, I can email my small Excel files to you for your expert diagnosis :) -- millzenator ------------------------------------------------------------------------ millzenator's Profile: http://www.excelforum.com/member.php...o&userid=28042 View this thread: http://www.excelforum.com/showthread...hreadid=475490 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Display Problem | Excel Discussion (Misc queries) | |||
EXCEL 2003 PROBLEM | Excel Worksheet Functions | |||
Freeze Pane problem in shared workbooks | Excel Discussion (Misc queries) | |||
Row Autofit problem Excel 2003 | Excel Discussion (Misc queries) | |||
Paper Tray selection Problem, | Excel Discussion (Misc queries) |