The tutorial explains how to search for duplicates in Excel. You will learn a few formulas to identify duplicate values or find duplicate rows with or without first occurrences. You will also learn how to count instances of each duplicate record individually and find the total number of dupes in a column, how to filter out duplicates, and more.
While working with a large Excel worksheet or consolidating several small spreadsheets into a bigger one, you may find lots of duplicate rows in it. In one of our previous tutorials, we discussed various ways to compare two tables or columns for duplicates.
And today, I'd like to share a few quick and effective methods to identify duplicates in a single list. These solutions work in all versions of Excel 365, Excel 2021, Excel 2019, Excel 2016, Excel 2013 and lower.
How to identify duplicates in Excel
The easiest way to detect duplicates in Excel is using the COUNTIF function. Depending on whether you want to find duplicate values with or without first occurrences, there's going to be a slight variation in the formula as shown in the following examples.
How to find duplicate records including 1st occurrences
Supposing you have a list of items in column A that you want to check for duplicates. These can be invoices, product Id's, names or any other data.
Here's a formula to find duplicates in Excel including first occurrences (where A2 is the topmost cell):
=COUNTIF(A:A, A2)>1
Input the above formula in B2, then select B2 and drag the fill handle to copy the formula down to other cells:
As you can see in the screenshot above, the formula returns TRUE for duplicate values and FALSE for unique values.
Note. If you need to find duplicates in a range of cells rather than in an entire column, remember to lock that range with the $ sign. For example, to search for duplicates in cells A2:A8, use this formula:
=COUNTIF($A$2:$A$8, A2)>1
For a duplicate formula to return something more meaningful than the Boolean values of TRUE and FALSE, enclose it in the IF function and type any labels you want for duplicate and unique values:
=IF(COUNTIF($A$2:$A$8, $A2)>1, "Duplicate", "Unique")
In case, you want an Excel formula to find duplicates only, replace "Unique" with an empty string ("") like this:
=IF(COUNTIF($A$2:$A$8, $A2)>1, "Duplicate", "")
The formula will return "Duplicates" for duplicate records, and a blank cell for unique records:
How to search for duplicates in Excel without 1st occurrences
In case you plan to filter or remove duplicates after finding them, using the above formula is not safe because it marks all identical records as duplicates. And if you want to keep the unique values in your list, then you cannot delete all duplicate records, you need to only delete the 2nd and all subsequent instances.
So, let's modify our Excel duplicate formula by using absolute and relative cell references where appropriate:
=IF(COUNTIF($A$2:$A2, $A2)>1, "Duplicate", "")
As you can see in the following screenshot, this formula does not identity the first occurrence of "Apples" as duplicate:
How to find case-sensitive duplicates in Excel
In situations when you need to identify exact duplicates including the text case, use this generic array formula (entered by pressing Ctrl + Shift + Enter):
At the heart of the formula, you use the EXACT function to compare the target cell with each cell in the specified range exactly. The result of this operation is an array of TRUE (match) and FALSE (not match), which is coerced to an array of 1's and 0's by the unary operator (--). After that, the SUM function adds up the numbers, and if the sum is greater than 1, the IF function reports a "Duplicate".
For our sample dataset, the formula goes as follows:
=IF(SUM((--EXACT($A$2:$A$8,A2)))<=1,"","Duplicate")
As shown in the screenshot below, it treats lowercase and uppercase as different characters (APPLES is not identified as a duplicate):
Tip. If you are using Google spreadsheets, the following article might be helpful: How to find and remove duplicates in Google Sheets.
How to find duplicate rows in Excel
If your aim is to dedupe a table consisting of several columns, then you need a formula that can check each column and identify only absolute duplicate rows, i.e. rows that have completely equal values in all columns.
Let's consider the following example. Supposing, you have order numbers in column A, dates in column B, and ordered items in column C, and you want to find duplicate rows with the same order number, date and item. For this, we are going to create a duplicate formula based on the COUNTIFS function that allows checking multiple criteria at a time:
To search for duplicate rows with 1st occurrences, use this formula:
=IF(COUNTIFS($A$2:$A$8,$A2,$B$2:$B$8,$B2,$C$2:$C$8,$C2)>1, "Duplicate row", "")
The following screenshot demonstrates that the formula really locates only the rows that have identical values in all 3 columns. For example, row 8 has the same order number and date as rows 2 and 5, but a different item in column C, and therefore it is not marked as duplicate row:
To show duplicate rows without 1st occurrences, make a little adjustment to the above formula:
=IF(COUNTIFS($A$2:$A2,$A2,$B$2:$B2,$B2,$B$2:$B2,$B2,$C$2:$C2,$C2,) >1, "Duplicate row", "")
How to count duplicates in Excel
If you want to know the exact number of identical records in your Excel sheet, use one of the following formulas to count duplicates.
Count instances of each duplicate record individually
When you have a column with duplicated values, you may often need to know how many duplicates are there for each of those values.
To find out how many times this or that entry occurs in your Excel worksheet, use a simple COUNTIF formula, where A2 is the first and A8 is the last item of the list:
=COUNTIF($A$2:$A$8, $A2)
As demonstrated in the following screenshot, the formula counts the occurrences of each item: "Apples" occurs 3 times, "Green bananas" - 2 times, "Bananas" and "Oranges" only once.
If you want to identify 1st, 2nd, 3rd, etc. occurrences of each item, use the following formula:
=COUNTIF($A$2:$A2, $A2)
In a similar manner, you can count the occurrences of duplicated rows. The only difference is that you will need to use the COUNTIFS function instead of COUNTIF. For example:
=COUNTIFS($A$2:$A$8, $A2, $B$2:$B$8, $B2)
Once the duplicate values are counted, you can hide unique values and only view duplicates, or vice versa. To do this, apply Excel's auto-filter as demonstrated in the following example: How to filter out duplicates in Excel.
Count the total number of duplicates in a column(s)
The easiest way to count duplicates in a column is to employ any of the formulas we used to identify duplicates in Excel (with or without first occurrences). And then you can count duplicate values by using the following COUNTIF formula:
=COUNTIF(range, "duplicate")
Where "duplicate" is the label you used in the formula that locates duplicates.
In this example, our duplicate formula takes the following shape:
=COUNTIF(B2:B8, "duplicate")
Another way to count duplicate values in Excel by using a more complex array formula. An advantage of this approach is that it does not require a helper column:
=ROWS($A$2:$A$8)-SUM(IF( COUNTIF($A$2:$A$8,$A$2:$A$8)=1,1,0))
Because it's an array formula, remember to press Ctrl + Shift + Enter to complete it. Also, please keep in mind that this formula counts all duplicate records, including first occurrences:
To find the total number of duplicate rows, embed the COUNTIFS function instead of COUNTIF in the above formula, and specify all of the columns you want to check for duplicates. For example, to count duplicate rows based on columns A and B, enter the following formula in your Excel sheet:
=ROWS($A$2:$A$8)-SUM(IF( COUNTIFS($A$2:$A$8,$A$2:$A$8, $B$2:$B$8,$B$2:$B$8)=1,1,0))
How to filter duplicates in Excel
For easier data analysis, you may want to filter your data to only display duplicates. In other situations, you may need the opposite - hide duplicates and view unique records. Below you will find solutions for both scenarios.
How to show and hide duplicates in Excel
If you want to see all duplicates at a glance, use one of the formulas to find duplicates in Excel that better suits your needs. Then select your table, switch to the Data tab, and click the Filter button. Alternatively, you can click Sort & Filter > Filter on the Home tab in the Editing group.
Tip. To have filtering enabled automatically, convert your data to a fully-functional Excel table. Just select all data and press the Ctrl + T shortcut.
After that, click the arrow in the header of the Duplicate column and check the "Duplicate row" box to show duplicates. If you want to filter out, i.e. hide duplicates, select "Unique" to view only unique records:
And now, you can sort duplicates by the key column to group them for easier analysis. In this example, we can sort duplicate rows by the Order number column:
How to filter duplicates by their occurrences
If you want to show 2nd, 3rd, or Nth occurrences of duplicate values, use the formula to count duplicate instances we discussed earlier:
=COUNTIF($A$2:$A2, $A2)
Then apply filtering to your table and select only the occurrence(s) you want to view. For example, you can filter the 2nd occurrences like in the following screenshot:
To display all duplicate records, i.e. occurrences greater than 1, click the filter arrow in the header of the Occurrences column (the column with the formula), and then click Number Filters > Greater Than.
Select "is greater than" in the first box, type 1 in the box next to it, and click the OK button:
In a similar manner, you can show 2nd, 3rd and all subsequent duplicate occurrences. Just type the required number in the box next to "is greater than".
Highlight, select, clear, delete, copy or move duplicates
After you've filtered duplicates like demonstrated above, you have a variety of choices to deal with them.
How to select duplicates in Excel
To select duplicates, including column headers, filter them, click on any filtered cell to select it, and then press Ctrl + A.
To select duplicate records without column headers, select the first (upper-left) cell, and press Ctrl + Shift + End to extend the selection to the last cell.
Tip. In most cases, the above shortcuts work fine and select filtered (visible) rows only. In some rare cases, mostly on very large workbooks, both visible and invisible cells may get selected. To fix this, use one of the above shortcuts first, and then press Alt + ; to select only visible cells, ignoring hidden rows.
How to clear or remove duplicates in Excel
To clear duplicates in Excel, select them, right click, and then click Clear Contents (or click the Clear button > Clear Contents on the Home tab, in the Editing group). This will delete the cell contents only, and you will have empty cells as the result. Selecting the filtered duplicate cells and pressing the Delete key will have the same effect.
To remove entire duplicate rows, filter duplicates, select the rows by dragging the mouse across the row headings, right click the selection, and then choose Delete Row from the context menu.
How to highlight duplicates in Excel
To highlight duplicate values, select the filtered dupes, click the Fill color button on the Home tab, in the Font group, and then select the color of your choosing.
Another way to highlight duplicates in Excel is using a built-in conditional formatting rule for duplicates, or creating a custom rule specially tailored for your sheet. Experienced Excel users won't have any problem with creating such a rule based on the formulas we used to check duplicates in Excel. If you are not very comfortable with Excel formulas or rules yet, you will find the detailed steps in this tutorial: How to highlight duplicates in Excel.
How to copy or move duplicates to another sheet
To copy duplicates, select them, press Ctrl + C, then open another sheet (a new or existing one), select the upper-left cell of the range where you want to copy the duplicates, and press Ctrl + V to paste them.
To move duplicates to another sheet, perform the same steps with the only difference that you press Ctrl + X (cut) instead of Ctrl + C (copy).
Duplicate Remover - fast and efficient way to locate duplicates in Excel
Now that you know how to use duplicate formulas in Excel, let me demonstrate you another quick, efficient and formula-free way - Duplicate Remover for Excel.
This all-in-one tool can search for duplicate or unique values in a single column or compare two columns. It can find, select and highlight duplicate records or entire duplicate rows, remove found dupes, copy or move them to another sheet. I think an example of practical use is worth many words, so let's get to it.
How to find duplicate rows in Excel in 2 quick steps
To test the capabilities of our Duplicate Remover add-in, I've created a table with a few hundred rows that looks like follows:
As you see, the table has a few columns. The first 3 columns contain the most relevant information, so we are going to search for duplicate rows based solely on the data in columns A - C. To find duplicate records in these columns, just do the following:
- Select any cell within your table and click the Dedupe Table button on the Excel ribbon. After installing our Ultimate Suite for Excel, you will find it on the Ablebits Data tab, in the Dedupe group.
- The smart add-in will pick up the entire table and ask you to specify the following two things:
- Select the columns to check for duplicates (in this example, these are the Order no., Order date and Item columns).
- Choose an action to perform on duplicates. Because our purpose is to identify duplicate rows, I've selected the Add a status column
Apart from adding a status column, an array of other options are available to you:
- Delete duplicates
- Color (highlight) duplicates
- Select duplicates
- Copy duplicates to a new worksheet
- Move duplicates to a new worksheet
Click the OK button and wait for a few seconds. Done!
As you can see in the below screenshot, all of the rows that have identical values in the first 3 columns have been located (first occurrences are not identified as duplicates).
If you want more options to dedupe your worksheets, use the Duplicate Remover wizard that can find duplicates with or without first occurrences as well as unique values. The detailed steps follow below.
Duplicate Remover wizard - more options to search for duplicates in Excel
Depending on a particular sheet you are working with, you may or may not want to treat the first instances of identical records as duplicates. One possible solution is using a different formula for each scenario, as we discussed in How to identify duplicates in Excel. If you are looking for a fast, accurate and formula-free method, try the Duplicate Remover wizard:
- Select any cell within your table and click the Duplicate Remover button on the Ablebits Data tab. The wizard will run and the entire table will get selected.
- On the next step, you are presented with the 4 options to check duplicates in your Excel sheet:
- Duplicates without 1st occurrences
- Duplicates with 1st occurrences
- Unique values
- Unique values and 1st duplicate occurrences
For this example, let's go with the second option, i.e. Duplicates + 1st occurrences:
- Now, select the columns where you want to check duplicates. Like in the previous example, we are selecting the first 3 columns:
- Finally, choose an action you want to perform on duplicates. As is the case with the Dedupe Table tool, the Duplicate Remover wizard can identify, select, highlight, delete, copy or move duplicates.
Because the purpose of this tutorial is to demonstrate different ways to identify duplicates in Excel, let's check the corresponding option and click Finish:
It only takes a fraction of a second for the Duplicate Remover wizard to check hundreds of rows, and deliver the following result:
No formulas, no stress, no errors - always swift and impeccable results :)
If you are interested to try these tools to find duplicates in your Excel sheets, you are most welcome to download an evaluation version below. Your feedback in comments will be greatly appreciated!
Available downloads
Identify Duplicates - formula examples (.xlsx file)
Ultimate Suite - trial version (.exe file)
262 comments
I have a starting 6-digit sequence # in cell L2 and an ending 6 digit sequence # in cell M2. These represent ranges of sequence numbers. They could be a few hundred to a hundred thousand. L2 would be a specified job, L3 another and so forth, each job with unique sequence numbers. These ranges of sequence numbers go on through L40 and M40. I want to make sure that nothing in any of these ranges of numbers are duplicates.
Right now I have =COUNTIF($L$2:$M$35,L2)>1 but this only recognizes the actual printed number and not the numbers that are hidden in the range. 748375(L2) to 749927(M2) for example. If another line contains 749926, that is an encroachment and should be flagged as a duplicate.
Hi!
Unfortunately, Excel formulas can only work with values that are written to cells.
Finally a clear listed formulas!
I have already located duplicated cells with conditional formatting into highlighted cells.
But which formula / method would work the best for finding duplicate values (names) across few rows, I was comparing two name lists which I have stripped every word into single cells.
I I'd love to try one by one but it loads for so long every time I input anything.
Thanks in advance!
Hello!
The fastest method for finding duplicates is the Duplicate Remover. But the parameters of your computer and its speed are also of great importance.
I have massive amounts of data in columns B and columns C. column B is lists of names and column c is just a location number like "1234" and that's it. I need a formula to filter out how many times column b and c duplicate and it to show me exactly who is duplicated and how many times.
Hello!
How to identify duplicate rows and how to count duplicates, you can read in this article above. Have you tried these recommendations? If this is not what you wanted, please describe the problem in more detail.
Hello,
I have several files in pdf and i would like to cross check using excel if there are duplicate refs. Is there any formula for it?
Hi!
Excel formulas do not work with PDF files. The UNIQUE function get unique values in only one data range.
HI.
I want to compare two rows of number,find duplicate,but not triple numbers,only two same numbers,not more.
please help.
Hi!
If I understand your task correctly, try the following formula from the first paragraph:
=COUNTIF(A:A, A2)=2
I hope it’ll be helpful.
Hi,
A condition, my each column has
A1- Apple, B1- Apple, C1- Orange.
A2- Mango, B2- Apple, C2- Mango.
And so on, now I want in D1 and D2
only single fruit names with “/“ as its separator.
Pls help.
Hello!
Please have a look at this article - Extract unique values that occur only once.
Anyone have any idea how to highlight duplicates within the column itself across the entire sheet? Meaning to say the conditional formatting ignores duplicated between columns and just checks for duplicates within the column itself?
Hello!
Here is the article that may be helpful to you: How to highlight duplicates in Excel
Hello, I have a spreadsheet where I record sales for each day. So 29/11/2021 may contain =SUM:(M104, M108, M121) and then 30/11/2021 may contain =SUM:(M105, M107, M121). The "M121" is a duplicate in these formulas. Is there any way to find and delete these duplicates. Thanks
Hello!
To change formulas in multiple cells at the same time, you can use the Find & Replace tool. Replace ", M121" with an empty string.
Hello,
I'm not sure if this is the right post to make this question but... I was trying to make the collatz conjecture on excel and I was trying to find a formula that: if in any previous column a number has appeared or any of it's multiples by 2^n (example: if I have put the number 1 then with the collatz conjecture I would get a 1-4-2-1 so the next number to add would be a 3 because the 2 has already appeared on a previous column, then I would get a 3-10-5-16-8-4-2-1-4-2-1 (possibly would have ended up in 16 due to the number being 1*2^4) and the next number to appear would be number 7 because 6 is 3*2^1 and so forth) do we have any command on excel that allows us to simplify this problem and how would you do this?
Hi Alexander,
How do I compare 3 sheets for duplicates and highlight them? (the 3 sheets is in the same workbook).
For example, I want to check if Sheet1 A1:A5 have duplicates from Sheet2 A1:A5 and Sheet3 A1:A5?
Alexander , thank you very much.
Hi!
With the Compare Multiple Sheets tool, you can find and highlight differences across multiple sheets.
I want to create a condititional formula to highlight the duplicate values in a column. And then I want to copy that formula to different/multiple columns on the same and diff sheets.
2nd, when I type a question mark (?), then excel treats it as a duplicate, even when there is no duplicate ? in that column.
Kindly help.
Hello!
I cannot guess which formula and which data you are using. But the sign "?" is a wildcard, which you can read more about in this article.
How can i find the duplicate cell in different rows and multiple column?
and delete them?
Hello!
You cannot find duplicates in multiple columns and remove them using regular Excel formulas. You need to use a VBA macro. Or use the Duplicate Remover - Find Duplicate Cells tool.
It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free.
Hello,
Can you help me with my problem?
How to remove duplicates in different column?
original data It's like this:
1 1 5 5 5 3 4 4
and turn to this:
1 5 3 4
Remove the duplicates but retain the 1st one.
Thank you in advance.
Hello!
All duplicate detection methods require data to be arranged vertically in columns. Therefore, first, transpose the data as described in this guide. Then remove the duplicates. For detailed instructions, see this article. Then transpose the data again.
Thank you so much this was such a huge help!
Hello Alex!
i just want to know how do I command a duplicate cell to join to different cells into one
Example;
Column A Column B Column C (where a+b)
Apple Fruit Apple Fruit + Red
Apple Red
Banana Yellow Banana Yellow
How do i separate the duplicate numbers/codes from each other in one excel sheet? sample below?
1)
1759DD447361
1759DD447361
1759DD447369
1759DD447369
1759DD447381
1759DD447381
2)
1759DD447361
1759DD447369
1759DD447381
1759DD447361
1759DD447369
1759DD447381
Hi!
What does "separate the duplicate" mean? Have you tried the ways described in this blog post? If they don’t work for you, then please describe your task in detail, I’ll try to suggest a solution.
Thank you Alex!
In my previous comment, there are two items. Item 1) has all the records, while item 2) the duplicates have been separated on same excel sheet. How can i achieve that and still keep both records in same sheet?
Hi!
Use the Duplicate Remover to move the duplicates onto a separate sheet. Then, if necessary, move them to the original sheet in the desired place.
Thanks
This is great! However, I'm thinking of multiplying a certain no. or cell using if function for duplicates. Say if k3 cell duplicates within k1:k6, e3*85%, otherwise e3=100%.
Tried using this --> [=another formula*(if(countif(k1:k6,k3)>1,e3*0.85,e3*1)] but sadly errors.
Would anyone know how to go about this? Thanks in advance!
Hello!
This formula works for me.
=(A3+A4)*IF(COUNTIF(K1:K6,K3)>1,E3*0.85,E3*1)
If you get an error, please describe the problem in more detail.
You're Godsent. Got why it errors. I doubled the multiplication in the formula. Thanks so much! :)
how can we identify the duplicate location/reference designators in the different rows?
Example
1:-
R1 Duplicate in both.
R1.
R1,R11,R12,R35,R187,R196,R203,R220,R221,R230,R231,R232,R233,R245,R246,R272,R283,R292,R297,R303,R321,R322,R342,R343,R345,R346,R349,R386,R406,R409,R532,R544,R555,R811,R812,R1033,R1034,R1035,R1036,R1779..
2:-
R4 Duplicate in Both.
R4,R6.
R2,R3,R4,R5.
3:-
R5 Duplicate in Both.
R2,R3,R4,R5.
R5,R46,R47,R48,R49,R54,R58,R60,R61,R65,R75,R82,R83,R84,R85,R86,R87,R184,R189,R190,R191,R192,R193,R238,R239,R240,R241,R258,R265,R266,R267,R268,R275,R276,R277,R278,R286,R287,R288,R289,R293,R294,R295,R296,R298,R299,R301,R331,R332,R333,R334,R335,R336,R337,R338,R339,R341,R344,R351,R352,R353,R354,R355,R356,R357,R358,R705,R867,R921,R924,R977,R978,R980,R981,R1038,R1052,R1053,R1767,R1768,R1769,R1772,R1784,R1785,R1786.
Hello!
Split each cell. Use a comma as a separator. To do this, you can use the Split Text tool. Use Duplicate Remover - Find Duplicate Cells tool to find duplicates. It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free.
If something is still unclear, please feel free to ask.
Using a formula(s), is there a way to find duplicate rows with multiple columns but info in columns are not necessarily in the same order.where the examples below are considered duplicates even if they're not in order?
A B C D
LAX SFO ATL DUPLICATE
PDX ATL LAX
LAS ATL LAX
JAX LAX PDX
SFO ATL LAX DUPLICATE
JAX LAS MCI
Hello!
You cannot do this with a formula. Use Duplicate Remover.
Hello,
First, great tutorial, very useful. I applied some of the formulas to solve a situation. I just needed to know if the data I load into an Excel table is duplicated, I don't need to know which rows are repeated, just to know the data is wrong so I can go to source to solve a problem I didn't know existed. The approach of the array formula that does not require a helper column seems the best option:
=ROWS($A$2:$A$8)-SUM(IF( COUNTIFS($A$2:$A$8,$A$2:$A$8, $B$2:$B$8,$B$2:$B$8)=1,1,0))
But then I came across a situation. Sometimes one of the columns can have a blank value, when that happens the formula identifies that row as not unique and returns a wrong value. I could fix the situation with this formula:
=ROWS($A$2:$A$8)- SUM(--( COUNTIFS($A$2:$A$8,$A$2:$A$8, $B$2:$B$8,choose({1,2},$B$2:$B$8,""))=1))
As you can see, I added the "choose" function with {1,2} as the index num so the "Choose" function returns both, the complete range that is used as criteria plus the empty space value "" counting correctly the blank cells when needed.
Another change I did was the use of "--" instead of the "if" function, but that doesn't change the result.
Hi,
I have 1500 lines data, I have to identify the duplicate with B collom and C collom,if that should match cell details and C cell details,how can I apply the formula for identifying the duplicate with same details matching with more than one.
Hi! It's hard to tell exactly what you're asking for as it's currently written. Pay attention to the following paragraph of the article above: How to find duplicate rows in Excel. Or explain your problem in more detail.