简体   繁体   中英

Counting unique dates between two dates in Excel

I am stuck with the issue to calculate number of unique dates between two dates. My sample table looks like this:

Column A     Column B     Column C     Column D 
10/1/2015
1/8/2016
2/25/2016                 2/1/2016     3/15/2016 
2/25/2016
2/25/2016
3/4/2016
3/24/2016

C3:D3 hold from and to dates respectively.

And this is my formula I am trying to get to work:

=SUMPRODUCT(--(FREQUENCY(IF(A1:A7>=C3+0,A1:A7,0),IF(A1:A7<=D3+0,A1:A7,0))>0))

It gives me some number, but the numbers are not correct. For this particular example I get 1 when 2 is expected. Any ideas what is wrong here?

Try:

=SUM(N(FREQUENCY(IF((myRange>=C3)*(myRange<=D3),myRange,""),IF((myRange>=C3)*(myRange<=D3),myRange,""))>0))

entered as an array formula by holding down ctrl+shift while hitting enter

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM