I've reworked your upload with some suggested modification to expedite use and minimize the need for future edits in two cases.
There is a helper column in column D. It can be hidden if you wish. It streamlines calculations and simplifies formulas by first subtracting all openDates from all closeDates. The formula in D2 filled down is
There is a data validation list of FOM dates 2016-2017 in column I. It is applied to a drop down in E1 for convenience.
There are three formulas all equally valid and all returning the same results.
In E2 this formula resembles what you were trying to do in the attempts Post #3. It must be array entered. If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.
The next two do not have to be array entered and take advantage of the IFs family of functions to reference whole columns without noticeable load. This makes "future proofing" the formulas almost unnecessary.
Bookmarks