Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.
Public Function Forcast(startdate As Date, enddate As Date, day As Integer, amount As Double) As String
Dim result As Double
Dim wage As Double
'-- initialise
result = 0
wage = 565
For d = startdate To enddate
'-- add planned dates
If DatePart("d", d) = day Then result = result + amount
'-- add income on fridays
'If Weekday(d, vbMonday) = 5 Then result = result + wage
Next d
process = result
End Function
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Join the community of 500,000 technology professionals and ask your questions.