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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top