Number of days in a quarter between two date ranges
Hello Joel,
I would suggest this UDF:
Option Explicit
Function DaysWithinDays(StartDate As Date, EndDate As Date, _
ActualStart As Date, ActualEnd As Date) As Long
If (ActualStart <= EndDate) And (ActualEnd = StartDate) Then
If ActualStart < StartDate Then
ActualStart = StartDate
End If
If ActualEnd EndDate Then
ActualEnd = EndDate
End If
DaysWithinDays = ActualEnd - ActualStart + 1
Else
DaysWithinDays = 0
End If
End Function
Regards,
Bernd
|