The below would work, I think, but it's a bit brute force and tbh you would most likely be best served using a User Defined Function.
The use of a couple of dynamic named ranges is really just to simplify should you add/remove dates (no need to modify range references)
with the sample file as provided the above would return same as Kaper's post but your example in the initial post implies you need to account for possibility of not every date being with the range(s) - so int he attached I added some additional date ranges which don't overlap completely - so you can see the above will adjust/account for that.
(there's no doubt a simpler formula-based approach that is escaping me... )
Bookmarks