View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernd P Bernd P is offline
external usenet poster
 
Posts: 806
Default 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