View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Alan McQ via OfficeKB.com Alan McQ via OfficeKB.com is offline
external usenet poster
 
Posts: 5
Default Number of Specific Day within Dates

Hi Abdul,

You can use the below function to count the days. First though, you will need
to copy the code at the end of this post into a VBA module.

A1 B1 C1 D1
1 Jun 2009 30 Jun 2009 Thursday =countday(A1,B1,C1)


Public Function CountDay(StartDate As Date, EndDate As Date, DayName As
String) As Long
Dim iDate As Date, dCount As Long

iDate = StartDate
dCount = 0

Do Until iDate EndDate
If Not iDate EndDate Then
If Format(iDate, "dddd") = DayName Then
dCount = dCount + 1
End If
End If
iDate = iDate + 1
Loop

CountDay = dCount

End Function

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200906/1