Count only unique values

cunningAce

Board Regular
Joined
Dec 21, 2017
Messages
91
Office Version
  1. 365
Platform
  1. Windows
Hi,

In the example below I want to be able to enter the date and have the formula return the number of unique ID's related to it.
So the result would be 9 in this case.

Thanks in advance for your help

ABCDE
1DateIDDateCount
218/06/2018118/06/2018
318/06/20181
418/06/20181
518/06/20182
618/06/20182
718/06/20182
818/06/20183
918/06/20184
1018/06/20185
1118/06/20186
1218/06/20186
1318/06/20187
1418/06/20187
1518/06/20187
1618/06/20188
1718/06/20188
1818/06/20189
1918/06/20189
2018/06/20189

<tbody>
</tbody>

 
Last edited:

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Excel 2013/2016
ABCDE
1DateIDDateCount
26/18/201816/18/20189
36/18/20181
46/18/20181
56/18/20182
66/18/20182
76/18/20182
86/18/20183
96/18/20184
106/18/20185
116/18/20186
126/18/20186
136/18/20187
146/18/20187
156/18/20187
166/18/20188
176/18/20188
186/18/20189
196/18/20189
206/18/20189
Sheet3
Cell Formulas
RangeFormula
E2=SUMPRODUCT(1/COUNTIFS(B2:B20,B2:B20,A2:A20,A2:A20),N(A2:A20=D2))
 
Upvote 0
Hi,

Thanks for your response,
This works for the example but when I add to my data with new dates and IDs it doesn't work. Can help to amend?


Book1
ABCDE
1DateIDDateCount
218/06/2018119/06/2018#VALUE!
318/06/20181
418/06/20181
518/06/20182
618/06/20182
718/06/20182
818/06/20183
918/06/20184
1018/06/20185
1118/06/20186
1219/06/20181
1319/06/20182
1419/06/20183
1519/06/20184
1619/06/20185
1719/06/20186
1819/06/20187
1919/06/20188
2019/06/20189
Sheet1
Cell Formulas
RangeFormula
E2=SUM(IF(FREQUENCY(IF($A$2:$A$20=D2,$B$2:$B$20),$B$2:$B$20),1))
 
Upvote 0
Hi,

Thanks for your help. This works. The only downfall is my data is quite large and when I change the cell references to complete rows the calculation is incredibly slow
 
Upvote 0
Care to post the formula as you implement it?

I am using the Frequency formula that you suggested. I had replied to the other suggestion using product regarding calculation time.

I prefer the Frequency formula as its quick but doesn't work when I add dates and Ids to the data.
 
Upvote 0
Hi,

Thanks for your response,
This works for the example but when I add to my data with new dates and IDs it doesn't work. Can help to amend?


Book1
ABCDE
1DateIDDateCount
218/06/2018119/06/2018#VALUE!
318/06/20181
418/06/20181
518/06/20182
618/06/20182
718/06/20182
818/06/20183
918/06/20184
1018/06/20185
1118/06/20186
1219/06/20181
1319/06/20182
1419/06/20183
1519/06/20184
1619/06/20185
1719/06/20186
1819/06/20187
1919/06/20188
2019/06/20189
Sheet1
Cell Formulas
RangeFormula
E2=SUM(IF(FREQUENCY(IF($A$2:$A$20=D2,$B$2:$B$20),$B$2:$B$20),1))

I am using the Frequency formula that you suggested. I had replied to the other suggestion using product regarding calculation time.

I prefer the Frequency formula as its quick but doesn't work when I add dates and Ids to the data.

You need to confirm the formula with control+shift+enter, not just with enter. I have apparently forgotten to mention that.
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,438
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top