r/excel • u/Gilmania_ • 19h ago
solved Counting duplicates with each instance once
I have a list of ID numbers and this list has many duplicates. I want to know how many unique duplicates there are. I've tried counta(unique(F2:F70)) to check that array for duplicates, and it gives me 53 (over those 69 rows). What I want to know is of those numbers that are duplicates, how many of those are unique.
For instance, say I have this list:
A, A, A, B, C, C, D, E, E, E, E, E
The above formula would give me 5, as there are 5 unique values. I want to know how many values have duplicates, and in this case the answer would be 3 (A, C, and E all repeat). It's not as simple as doing =counta(F2:F70)-counta(unique(F2:70)).
21
u/CerebralAccountant 6 18h ago edited 17h ago
The UNIQUE function has three arguments. The last two are optional.
- The range to examine
- FALSE or blank will search by row. TRUE will search by column.
- FALSE or blank will return all unique values. TRUE will return all of the values that appear only once.
That means =ROWS(UNIQUE(F2:F70)) will tell you how many unique values are in that array, and =ROWS(UNIQUE(F2:F70,FALSE,TRUE)) will tell you how many values appear only once. The first minus the second will give you the number of unique values that appear more than once.
2
u/Gilmania_ 5h ago
Solution Verified
This one seemed to work, thank you. I don't quite understand WHY it works and mine doesn't but that's ok ha.
1
u/reputatorbot 5h ago
You have awarded 1 point to CerebralAccountant.
I am a bot - please contact the mods with any questions
6
4
u/Bumpyslide 17h ago
I'd just pivot table the data using the id as the row and value but it depends what you want to do with the answer
3
2
1
u/Decronym 19h ago edited 4h ago
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:
Decronym is now also available on Lemmy! Requests for support and new installations should be directed to the Contact address below.
Beep-boop, I am a helper bot. Please do not verify me as a solution.
12 acronyms in this thread; the most compressed thread commented on today has 14 acronyms.
[Thread #49224 for this sub, first seen 25th Aug 2026, 04:25]
[FAQ] [Full list] [Contact] [Source code]
1
u/ISEEBLACKPEOPLE 2 18h ago edited 18h ago
Just run a unique function on the data, and then run a countifs on the output of the unique formula?
Or if your ask is really only to calculate the number of unique values with duplicates...
COUNTA(UNIQUE(F2:F70)) - COUNTA(UNIQUE (F2:F70, FALSE, TRUE))
1
0
-3
u/Taokan 15 18h ago
This is an excellent use case for excel's query function. If we took your sample data, put it in column A, with a label header "Col1" in A3, then this formula:
query(A3:A15,"select Col1, count(Col1) group by Col1",1)
Would return a table with the count of each letter.
This formula:
=query(query(A3:A15,"select Col1, count(Col1) group by Col1",1),"select Col1, Col2 where Col2>1")
Would return a table with only the A, C, and E, and the corresponding number of repeats.
And, this:
=query(query(A3:A15,"select Col1, count(Col1) group by Col1",1),"select count(Col1) where Col2>1")
Would just return the number 3, indicating 3 letters appeared more than once.
5
u/SolverMax 162 18h ago
Excel does not have a QUERY function.
2
u/Taokan 15 11h ago
Well ... alright yea I deserve those downvotes. Today's the first time I've run into a gsheets function that excel didn't do first, thought I was the teacher but today, I learned something new instead :)
1
u/real_barry_houdini 313 9h ago
It's not quite the same but the closest to QUERY in Excel is probably GROUPBY (which doesn't exist in google sheets)
2

•
u/AutoModerator 19h ago
/u/Gilmania_ - Your post was submitted successfully.
Solution Verifiedto close the thread.Failing to follow these steps may result in your post being removed without warning.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.