# Counting Unique values within a specified date range

1. ## Counting Unique values within a specified date range

I have a worksheet with 10000 + lines. Column A2:A10000 contains quote numbers. These can be duplicates. Column B contains the date in which the quote was entered. These can be duplicates. I need a formula that will count the number of unique quote numbers (column A) that fall within a date range (from column B). The desired date range is to be entered by other users in cells K2 (start) and L2 (end). So if there are 5 lines within the given date range that have the same quote number, it would count them as 1.

I have a pivot table in place that will do this, but I am designing an "executive summary" tab that the boss can use, as he is not adept at pivot tables. I need it so he can just enter the date range, and it spits out the numbers. I have the following formulas in place, but can't get the two to combine.

To count the number of lines in the given date range:
=COUNTIFS(B2:B10000,">="&K2,B2:B10000,"<="&L2)

To count the number of uniqe quotes in the entire sheet:
=SUM(IF(FREQUENCY(MATCH(A2:A910000,A2:A10000,0),MATCH(A2:A10000,A2:A10000,0))>0,1))

Any help is GREATLY APPRECIATED!

2. ## Re: Counting Unique values within a specified date range

Hi

One way.

In D1 and copy down, use this.

=COUNTIF(\$A\$1:\$A1,A1)

Then amend your formula, like this.

=COUNTIFS(B2:B10000,">="&K2;B2:B10000,"<="&L2;D2:D10000,1)

3. ## Re: Counting Unique values within a specified date range

Holy crap, you're a genious! Had to replace the semicolons with commas, but it works perfectly now.

Thank you!

There are currently 1 users browsing this thread. (0 members and 1 guests)