Reputation: 30311
Lets say I have a named range of dates that are holidays. This range is called 'holidays'. Is there a formula in Excel I could use to count the number of holidays that fall between 2 dates?
e.g. holidays = 7/3/2011, date 1 = 7/1/2011, date 2 = 7/7/2011: this formula calculates 1.
Edit: it seems the function =NETWORKDAYS
gets me part of the way there, but as Excellll points out it only works if the holidays fall on weekdays.
Upvotes: 3
Views: 10175
Reputation: 1
With the following formula you can get it. NETWORKDAYS.INTL(start_date, end_date, [weekend], [holidays]) Use "0000000" including semicolons, to define weekend is none, then if desired any special weekend not on the options can be defined by specifying the desired weekend days as holidays.
Upvotes: 0
Reputation: 27478
Assuming you also have ranges named "date1" and "date2" this will work. It's inclusive, e.g., it will count New Years Day if date1 = 1/1/11. Remove the "="s if you don't want that.
=SUMPRODUCT((holidays>=date1)*(holidays<=date2))
Upvotes: 4