Question Locked

Specific Date range within a column

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am working on a spreadsheet that contains multiple effective dates. I want to only count those fields that have dates that fall in a specific range. Can anyone help me with a formula to accomplish this?

2 replies

by thumbsup2

The formula below assumes the dates you are looking at are in A2 through A5. In C2, you put the first date of your range, in D2 you put the last date of your range. The formula will search the dates in column A looking for the ones which are greater than C2 and less than D2 and return a number to indicate how many dates meet the criteria. It doesn't matter how the dates are formatted. It only matters that they are all formatted as a date. Excel stores all dates as an internal number, so greater than and less than is easy to calculate.

=SUM(IF((A2:A5>$C$2)*(A2:A5<$D$2),1,0))

Now, the trick is, after you've typed the formula above and before you press enter or tab to leave the cell, press CTRL+SHIFT+ENTER instead. If you don't do this, you will get the #VALUE error. If you accidentally press enter too soon, go back to that cell again, press F2 (which puts the cursor into the formula bar, or just click up there) and then press CTRL+SHIFT+ENTER.

When it's done right and you look at the contents of that cell again, you will see the curley brackets { and } around the whole thing. But, you can't type those curley brackets. You must use the 3-key combination to enter the formula as an array formula.

{=SUM(IF((A2:A5>$C$2)*(A2:A5<$D$2),1,0))}

Hope this helps.

...

This discussion is closed to new replies.