Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

count the number of unique records within date range

$
0
0

I have a spreadsheet with the following three columns (A=resource code, B=start date, C=end date). I am trying to count the number of unique resource codes that overlap for any date of the year.

ABC
Resource CodeStart DateEnd Date
JF23-Dec-2107-Jan-22
ED01-Nov-2131-Apr-22
ED01-Apr-2231-Jun-22
ED13-Sep-2131-Mar-22
EN03-Jan-2207-Jan-22
ED11-Jan-2221-Mar-22
JF17-Jan-2201-Feb-22
CHST17-Jan-2231-Mar-22
FROL17-Jan-2231-Mar-22
THBR17-Jan-2231-Mar-22
ED01-Jan-2231-Mar-22

If A6 = 20/04/22

The code I have got so far is:

=COUNTIFS($B$2:$B$1000,"<="&A6,$C$2:$C$1000,">="&A6)

This comes up with the count of rows with date ranges that the date 20/04/22 falls within (i.e. twice). However I want to only count this when there are unique records. In this instance it is ED that is the resource code for both instances. This is only one unique resource code, and therefore I would like my formula to return '1'. I have had a play with unique() function but have not succeeded.


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>