How can I use Excel to count the unique values within a specific date range? 2

How can I use Excel to count the unique values within a specific date range?

Excel is a powerful tool that allows users to manipulate and analyze data efficiently. One useful feature of Excel is the ability to count unique values within a specific date range. This function can be utilized by utilizing the “COUNTIFS” formula, which allows users to specify a criteria range and a criteria to count unique values within a specific date range. By following this method, users can easily track and analyze data within a specific time period, providing valuable insights and data management capabilities. This feature is especially useful for businesses and individuals who need to track and analyze data within a specific time frame, making Excel an essential tool for data management and analysis.

Excel: Count Unique Values Based on Date Range


You can use the following formula to count the number of unique values based on a date range in Excel:

=SUMPRODUCT(IF((A2:A11<=E2)*(A2:A11>=E1),1/COUNTIFS(A2:A11,"<="&E2,A2:A11,">="&E1,B2:B11,B2:B11),0))

This particular formula counts the number of unique values in the range B2:B11 where the corresponding date in the range A2:A11 is between the start date in cell E1 and the end date in cell E2.

The following example shows how to use this formula in practice.

Example: Count Unique Values Based on Date Range in Excel

Suppose we have the following dataset that contains information about products sold on various dates by some retail store:

Suppose we would like to count the number of unique items sold between 1/5/2023 and 1/20/2023.

We can type these start and end dates in cells E1 and E2, respectively, and then type the following formula into cell E3 to count the number of unique items sold between these dates:

=SUMPRODUCT(IF((A2:A11<=E2)*(A2:A11>=E1),1/COUNTIFS(A2:A11,"<="&E2,A2:A11,">="&E1,B2:B11,B2:B11),0))

The following screenshot shows how to use this formula in practice:

Excel count unique based on date

We can see that 3 unique items were sold between 1/5/2023 and 1/20/2023.

We can manually verify this is correct by identifying the three unique items sold between these dates:

  • Couch
  • Stool
  • Chair

Note that if we change the start or end date, the formula will automatically update to count the unique values between the new dates.

For example, suppose we change the end date to 1/30/2023:

We can see that 4 unique items were sold between 1/5/2023 and 1/30/2023.

We can manually verify this is correct by identifying the four unique items sold between these dates:

  • Couch
  • Stool
  • Chair
  • Clock

Feel free to change the start and end dates to whatever dates you’d like.

The following tutorials explain how to perform other common tasks in Excel:

Cite this article

stats writer (2024). How can I use Excel to count the unique values within a specific date range?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-use-excel-to-count-the-unique-values-within-a-specific-date-range/

stats writer. "How can I use Excel to count the unique values within a specific date range?." PSYCHOLOGICAL SCALES, 23 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-use-excel-to-count-the-unique-values-within-a-specific-date-range/.

stats writer. "How can I use Excel to count the unique values within a specific date range?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-use-excel-to-count-the-unique-values-within-a-specific-date-range/.

stats writer (2024) 'How can I use Excel to count the unique values within a specific date range?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-use-excel-to-count-the-unique-values-within-a-specific-date-range/.

[1] stats writer, "How can I use Excel to count the unique values within a specific date range?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I use Excel to count the unique values within a specific date range?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top