A while ago (well more than 3 years ago), I wrote about an array formula based technique to check if a list of values have any duplicates in them.
Today, lets learn a simpler formula to check if a list has duplicate numbers.
Assuming you have some numbers in a range B4:B10 as shown below,

You can use COUNTIF & MODE formulas to check if the list has any duplicates, like this:
=IF(COUNTIF($B$4:$B$10,MODE($B$4:$B$10))>1, "List has duplicates", "No duplicates")
How does it work?
MODE formula gives us the most frequently occurring number in a list. Then, we use COUNTIF to see how many times this number occurs in a list.
In a list with no duplicates mode value occurs only 1 time. If a list has duplicate numbers, then count of mode would be more than 1. That is what the IF formula checks for and then prints appropriate message.
See this example:
[Embedded Excel, if you can not see it, click here]
Play with below embedded Excel file to understand the technique. You can modify numbers or formula.
Or Download this Example
Click here to download the example workbook and play with it.
How do you check if a list has duplicates?
For text values, I use the array formula technique described here. For numeric values, I prefer MODE + COUNTIF combination because it is easy to write & explain.
What about you? How do you check if a list has duplicates? Which formulas do you use? Please share your techniques using comments.
More on Duplicates & Unique values
If we analyze the time an analyst spends on various things, we would realize,
- 30% of time cleaning data (removing duplicates etc.)
- 30% of time actual analysis
- 30% of time drinking coffee
- 10% of time actual presentation
On a more serious note, if you want to learn various techniques to deal with duplicate values, read on:
- Extracting unique values from a list in Excel using formulas
- Extracting unique values from a list using Pivot tables
- Count the number of values in a list (excluding duplicates)
- Quickly compare 2 lists and check for duplicates
- Removing duplicate values quickly
- Avoiding duplicate data entry using Data Validation
















One Response to “How to export YouTube video comments to Excel file? – Free template + Power Query case study”
And I asked myself when i saw your Accouncement Video for the Give away: "Seriously, will Chandoo go manualy thru all his Videos and pick the winners?!". Great connection to the give away with this tutorial 🙂 !