days calculation

  • Thread starter Thread starter Yousoft
  • Start date Start date
Y

Yousoft

Hi All
The following formula is calculating the no of days without holidays, so I
want this formula in excel function way.
=SUMPRODUCT(INT((D5-C5+WEEKDAY(C5-{1,2,3,4,5}))/7))
 
Here is the code
Function workdays(firstday, lastday, holidays)
workdays = WorksheetFunction.NetworkDays(firstday, lastday, holidays)
End Function

called with =workdays(a1,b1,d1:5) where A1 has the first day, B1 the last
day and D1:D5 a list of holiday dates

Not bothered by holidays?
Function workdays(firstday, lastday)
workdays = WorksheetFunction.NetworkDays(firstday, lastday)
End Function
called with =workdays(a1,b1,d1:5) where A1 has the first day, B1 the last
day

best wishes
 
Back
Top