How to count unique values between two dates in Excel?
Count unique values within date range by formula
Count unique values within date range by Kutools for Excel
To count unique values within a date range, you can apply a formula.
Select a cell that you will place the counted result, and type this formula =SUMPRODUCT(IF((B2:B8<=E2)*(B2:B8>=E1), 1/COUNTIFS(B2:B8, "<="&E2, B2:B8, ">="&E1, A2:A8, A2:A8), 0)), press Shift + Ctrl + Enter to get the correct result. See screenshot:
Tip: in the above formula, B2:B8 is the date cells in your data range, E1 is the start date, E2 is the end date, A2:A8 is the id cells you want to count unique values from. You can change these criteria as you need.
To count the unique values between two given dates, you also can apply Kutools for Excel’s Select Specific Cells utility to select all values between the two dates, and then apply its Select Duplicate & Unique Cells utility to count and find the unique values.
|Kutools for Excel, with more than 300 handy functions, makes your jobs more easier.|
After free installing Kutools for Excel, please do as below:
1. Select the date cells and click Kutools > Select > Select Specific Cells. See screenshot:
2. In the Select Specific Cells dialog, check Entire row option in Selection type section, select Greater than or equal to and Less than or equal to from the two drop down lists separately, check And between two drop down lists, and enter start date and end date separately in the two textboxes in Specific type section. See screenshot:
3. Click Ok, and a dialog pops out to remind you the number of selected rows, click OK to close it. Then press Ctrl + C and Ctrl + V to copy and paste the selected rows in another location. See screenshot:
4. Select the id numbers from the pasted range, click Kutools > Select > Select Duplicate & Unique Cells. See screenshot:
5. In the popping dialog, check All unique (Including 1st duplicates) option, and check Fill backcolor or Fill font color if you want to highlight the unique values, and click Ok. And now another dialog pops out to remind you the number of unique values, and at the same time the unique values are selected and highlighted. See screenshot:
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 1 months agoHi there! This worked perfectly for what I needed but I need to alter it so that it does not county blank cells - do you have any recommendations for this?
- To post as a guest, your comment is unpublished.· 8 months agoDo you know what formula apply to count non repeated values within a date range? In the example above it is 2. Thanks!
- To post as a guest, your comment is unpublished.· 1 years agoHi this formula works for me but i would like to add another criteria & say only find the uniques if
Table2[TASK]="PSHP" or "SHIP"
- To post as a guest, your comment is unpublished.· 2 years agocould you please help me with this issue
i need special formulas, i will explain what i want, i have sheet contain two columns (Date & Item) i received different items in one day and its repeated randomly, ex-
in each day i want to count how many TV/Radio/Oven..etc in each day only.
- To post as a guest, your comment is unpublished.· 2 years agoI think the pivottable can do you a favor.
- To post as a guest, your comment is unpublished.· 3 years agoThis formula doesn't
work for me just keeps giving me "0"
- To post as a guest, your comment is unpublished.· 3 years agoSorry that is not work for you, but the formula works perfect in my way. Could you upload screenshot of your file or descibe much more details about your problem? Maybe we can find the reason. Thank u.
- To post as a guest, your comment is unpublished.· 2 years agoDid you get to the bottom of this one? Mine is showing '0' too.
- To post as a guest, your comment is unpublished.· 2 years agoDo you hold Shift + Ctrl and press Enter key? Or is there any unique values in your date range?This formula used to count unique values in a date range only.
- To post as a guest, your comment is unpublished.· 3 years agoThanks for the great article. I tried using the below formula, but keep getting this error:
"Function DIVIDE parameter 2 cannot be zero."
[quote]=ArrayFormula(SUMPRODUCT(IF((D4:D200=M3), 1/COUNTIFS(D4:D200, "="&M3, C4:C200, C4:C200), 0)))[/quote]
D4:D200 - date span
C4:C200 - data span
M3 - the date (1st day of the month)