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 Chri
Foose.
Basically, Progressive Insurance requires that their jobs be complete
within a certain "cycle time", based on when the car arrives at th
shop and when the repairs are completed. A cycle time of 4.0 or 4.5 i
acceptable, but anything below that, and Progressive starts to limit th
number of vehicles that are brought to my friends shop for repairs. Hi
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 en
date and time. This sheet calculates the cycle time based on "fla
hours (the number of hours Progressive estimates that the repairs wil
take)".
I created another sheet where you input a start date and time, desire
cycle time, and it will tell you when the vehicle is due to maintai
the cycle time that you input in the cell.
What I need is to exclude weekend days, and the work hours for the wee
can include all 24 hours of each day. I only need to exclude weeken
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 th
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 yo
for your expert diagnosis :