hello everyone
how do you calculate "Fridays" that have passed from the start of the current month ?
hello everyone
how do you calculate "Fridays" that have passed from the start of the current month ?
count the numbers
Try the following function, if you want to start from today use the function with parameter datStartDay = Date() )
Public Function CalcFridays(datStartDay As Date) As Long
Dim intNrFridays As Integer
Dim intDay As Integer
intDay = Day(datStartDay)
intDay = intDay - DatePart("w", datStartDay, vbFriday)
Do While intDay > 0
intDay = intDay - 7
intNrFridays = intNrFridays + 1
Loop
CalcFridays = intNrFridays
End Function
Here's another
General:
DateDiff("ww",[StartDate],[Endate],6) ' the 6 represents Friday
use 1-Sun, 2-Mon.....6-Fri, 7-Sat
Specific:
?Datediff("ww",#1-Jan-18#,#24-Jan-18#,6)
3
Orange,
Thank you for posting that! I was just about to start working on a dashboard to calculate shipping days with the exclusion of Sundays between, and your example sparked a simple solution:
Me.Parent.txtDaysToDeliver = DateDiff("d", Me.DateShipped, Me.DateDelivered) - DateDiff("ww", Me.DateShipped, Me.DateDelivered, 1)
Cheers!
Good luck with your project, happy to help.
thanks ridders52, NoellaG, orange for your help