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
Hi,
I have a big datasheet. We run samples matched by MRN #. For example ID#1 has MRN 345 with label T and ID#2 has MRN 345 with Label N. If MRN 345 was run before and we have to run it again. the labels have to be T2 and Nrpt. Is there a way to do that in excel?
Hi! Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what do you want to do.
Hello Team:
In this forum you solve my many problems thanks,
Now I have also another problem, as i share the data which is duplicate values in a single column, these are duplicates and only find it
manually, not any formula or conditional formatting,
I need a formula to find the duplicate in the following text strings which is in a single column,the number shows how much time it is repeated, I find it manually
it is very large data file, so i need your help,
Thanks a lot advance:
1 8041-GTN to DC-44 Firdous Market
1 FZRD: OLT-1 to C-5 Pak Arab Society
1 8061-ARZ (2/0/7) to C-3/4 Bhobhtian Chowk
2 FRZD: OLT-1 to C-5 Pak Arab Society
1 SMD: MSAG-37 GOR-III to C-32 Cricket House GOR-II & C-3 Rehmania Park
1 SMD: OLT-1 to C-13 Truck Stand Adda
2 8061-ARZ (2/0/7) to C-3/4 Bhobhtian Chowk
4 8061-ARZ (11/0/7) to C-3/4 Bhobtian Chowk Defence Road
2 SMD: OLT-1 to C-13 Truck Stand Adda
1 FZRD: FZRD OLT-1 to MSAG-58 Near Advance Fashion
2 8041-GTN to DC-44 Firdous Market
3 8061-ARZ (2/0/7) to C-3/4 Bhobhtian Chowk Defence Road
2 FZRD: OLT-1 to MSAG-58 near Advance Fashion
1 BTN: OLT-1 to Leads Club Defence Road
8041-GTN to 8052-GLB
1 MLRD: OLT-1 to C-22 H#106 Awan Town
2 BTN: OLT-1 to Leads Club Defence Road
2 MLRD: OLT-1 to C-22 H#106 Awan Town
2 SMD: MSAG-37 GOR-III to C-3 Rehmania Park & C-32 Cricket House GOR-II
Hi! From your question, the desired result is not very clear. If I understand the question correctly, to calculate the number of duplicates in a column, use the recommendations from the paragraph above in the article: How to count duplicates in Excel. If that's not what you want, describe exactly what result you wanted.
Sir,
Thanks a lot for your response, actually I share my data that these text strings are duplicate but the problems that they are occurred in the
data that their sequence is not same but they are the same stations name and the same fault which are in a weekly fault report, I am searching manually and then pulled out from the report, I need a formula to find it and then i pulled out,
For example if you see the Sr.no. 1&11 are same fault but only the sequence is changed, sr.no.2&4,sr#3&7 and all other also, this a huge data and i
pulled the same fault occurance manuallu, I shall be very thankful to you for your help thanks a lot:
8041-GTN to DC-44 Firdous Market 1
FZRD: OLT-1 to C-5 Pak Arab Society 2
8061-ARZ (2/0/7) to C-3/4 Bhobhtian Chowk 3
FRZD: OLT-1 to C-5 Pak Arab Society 4
SMD: MSAG-37 GOR-III to C-32 Cricket House GOR-II & C-3 Rehmania Park 5
C-13 Truck Stand Adda to SMD: OLT-1 6
Bhobhtian Chowk to 8061-ARZ (2/0/7) and C-3/4 7
8061-ARZ (11/0/7) to C-3/4 Bhobtian Chowk Defence Road 8
SMD: OLT-1 to C-13 Truck Stand Adda 9
FZRD: FZRD OLT-1 to MSAG-58 Near Advance Fashion 10
Firdous Market to 8041-GTN DC-44 11
8061-ARZ (2/0/7) to C-3/4 Bhobhtian Chowk Defence Road 12
FZRD: OLT-1 to MSAG-58 near Advance Fashion 13
Hi! Sorry, I do not fully understand the task. As it's currently written, it's hard to tell exactly what you're asking. I don't see "sr.no." in your data. As I wrote before, specify exactly what result you want from the data you wrote.
Sir,
I am sorry, you do not understand what I want, as a already explain I share my data that these text strings are duplicate but the problems that they are occurred in the data that their sequence is not same but the same fault which are in a weekly fault report, I am searching manually and then pulled out from the report, I need a formula to find it and then i pulled out, If that are same I can use conditional formatting.
For example if you see the Sr.no. 1&11 are same fault but only the sequence is changed, sr.no.2&4,sr#3&7 and all other also, this a huge data and i pulled the same fault occurance manuallu, I shall be very thankful to you for your help thanks a lot:
SR.NO TEXT STRINGS
1 8041-GTN to DC-44 Firdous Market
2 FZRD: OLT-1 to C-5 Pak Arab Society
3 8061-ARZ (2/0/7) to C-3/4 Bhobhtian Chowk
4 FRZD: OLT-1 to C-5 Pak Arab Society
5 SMD: MSAG-37 GOR-III to C-32 Cricket House GOR-II & C-3 Rehmania Park
6 C-13 Truck Stand Adda to SMD: OLT-1
7 Bhobhtian Chowk to 8061-ARZ (2/0/7) and C-3/4
8 8061-ARZ (11/0/7) to C-3/4 Bhobtian Chowk Defence Road
9 SMD: OLT-1 to C-13 Truck Stand Adda
10 FZRD: FZRD OLT-1 to MSAG-58 Near Advance Fashion
11 Firdous Market to 8041-GTN DC-44
12 8061-ARZ (2/0/7) to C-3/4 Bhobhtian Chowk Defence Road
13 FZRD: OLT-1 to MSAG-58 near Advance Fashion
This is the third time you repeat the same thing and don't give an example of the result you want to get from the data you wrote. You have written 13 values. What result do you want to get from them? If you need to count duplicates, read the paragraph above: How to count duplicates in Excel
Thanks a lot sir,
I show this again and again that I want to get duplicate value like these text strings
Please use this
=SUMPRODUCT(--($A:$A=A2))
I have a spreadsheet with lots of rows of data and 5 columns, named "Guests", "Guest type", "Status", "No of Pax" and "Type of Meal".
What I'm looking for is how to find the duplicated guests and transpose those names with the sum of total pax, based on the criteria of the "Guest type", "Status" and "Type of Meal".
I hope I can make myself clear enough so you can help me out.
The final result would have the name of the client in one column and the total of meals based on those criteria on another column.
Thanks in advance.
Silvio
Hello! To calculate the total of meals based on the three criteria, use the COUNTIFS function. See the instructions and examples in this article: Excel COUNTIFS and COUNTIF with multiple AND / OR criteria. I hope it’ll be helpful.
Thank you for your reply. I basically know I to use the countif and countifs, but what I wanted is how to find the duplicate names, and when they are found how to automatically transpose those names plus the results of the criteria to different columns.
Say for example I have on column A 100 names with several that are duplicates (repeated guests). They all have a type of guest assigned, a status (confirmed, cancelled), number of persons assigned to that guest and type of meals (breakfast, lunch or dinner).
I only want to extract the information of duplicated names plus the total sum of persons assigned to those names, based on the criteria chosen, say type of, confirmed or cancelled and type of meals.
I hope you understand what I'm looking for.
Thank you
This is the formula I use to count number of meals based on those criteria
=SUMIFS($H$2:$H$5000;$C$2:$C$5000;"Passant";$G$2:$G$5000;"Confirmed";$J$2:$J$5000;"Dinner")
It works pretty well. Now I just want to identify from the list of names which are the clients that had been several times and based on the same criteria how many times they had dinner or a different meal.
Hi! You can count the number of customers by certain criteria using the COUNTIFS function.
Hi! You can get the list of duplicates to a separate column using any of the methods recommended in the article above. You can also extract a list of unique values from column A as described in this guide: Excel UNIQUE function - fastest way to find unique values.
Then in the next column, for each of the clients, do a calculation using the COUNTIFS function.
This is great information, but not sure if it addresses what I need to achieve:
I have a multi-level/hierarchial Bill of Materials of a product with multiple components, some sharing the same sub-components:
One column is the item number, that specifies the hierarchy, i.e. 1, 1.1, 1.1.1, 1.1.2... 1.1.10 etc
Other columns specify Description, Part Number, Material, and so on
The last column is the Quantity column
I want to be able to find parts with duplicate part numbers in the table, and return the Total Quantity of these shared parts somehow; possibly in another table/row, or *maybe* better a Total Quantity column
Hello!
If I understand the problem correctly, you can calculate the number of identical item numbers using the formulas from this guide: How to count duplicates in Excel.
I hope it’ll be helpful. If this is not what you wanted, please describe the problem in more detail.
Hi
I have list with thousands Products list
A- have Product Code
B Have names
C Have QTY
Now i need to Put price for each item in no 4 same items is repeated many times is their a way to put Price in all same items at Once?
Hi!
To quickly find the price for each of the 4 products and insert it into the table, use the VLOOKUP function. Please have a look at this article Excel VLOOKUP function tutorial with formula examples.
Dears,
I have a lot of paragraphs "in 2000 Rows" in the excel sheet and I want to extract value from them in specific line or to get the duplication from specific line.
Am doing analysis for debtors then i have two listings ,which formula can i use to find duplicates from last year listing to this year listing
Hi!
I think you will find the answer in this article: How to compare two columns in Excel for matches and differences.
Hi Guys, thanks for this very useful website and forum!
I have a weekly report showing a list of incoming calls to a ring group in a queue, with date (DD/MM/YYYY HH:MM:SS), caller ID (phone number), the agent id (extension number of receiving agent), and the status (answered, no answer, busy).
I am trying to work out the Call Abandon Rate so I need to identify a formula that looks for blocks of entries with same date and same phone number, and then refers to the 'status' column to determine whether at least one of the rows in the array is flagged as 'answered'.
Struggling to find a formula that does the job. Would anyone be able to assist?
Thanks, Tiziana
Hello!
If I understand your task correctly, use the FILTER function to get all the records by the criteria you specified
=(FILTER($D$2:$D$10,(--(INT($A$2:$A$10)=INT(A2)))* (--($B$2:$B$10=B2))* (--($D$2:$D$10="answered")),"")<>"")
Thanks Alexander, that works brilliantly!
Unfortunately I am getting a series of '#SPILL!' errors however, and since I am working on a rather large data set (7000+ rows), I am wondering whether there is a way for me to prevent this error from occurring? Otherwise I'd be left with manually deleting the obstructing cells, which could be very time consuming.
Thanks again, Tiziana
Hi!
Write the formula so it will not interfere with other data cells. For more information, read #SPILL! error in Excel - what it means and how to fix.
Thanks Alexander, I will check and let you know in case of difficulties!
Hi Alexander, I read through and applied the solution that's outlined on the indicated page: #SPILL! error in Excel - what it means and how to fix. The issue I'm facing however, is that clearing the obstructed cells for this data set of just over 6000 rows is proving to be fairly laborious. The SPILL# error appears at around the 75th row, and continues to reappear frequently thereafter. Would you know how else this may be tackled please? Thanks !
Hi!
Unfortunately, there are no other solutions besides clearing the cells. Either move the cell with the formula to an empty space or to another worksheet.
I have a column that consists of 100+ rows than contain several repeated values within a single cell, separated by commas:
example:
Cell A1: apple, apple, orange, banana, banana
Cell A2: orange, apple, banana
Cell A3: orange, orange, banana
. Is there a way I can have another column that indicates whether a single cell consist of "duplicates" (Cell A1 and A3) and "no duplicates." (Cell A2)?
Hello!
Your problem cannot be solved with a single formula. You can create a copy of this column. Then use the Remove Duplicate Substrings Tool to remove duplicates from the text cells in that column. Then compare the two columns and you will see differences where there were duplicates.
For more information, please read: Compare two columns for matches and differences.
Remove Duplicate Substrings Tool 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.
When I copy and paste the duplicate expression =COUNTIF(A:A, A2)>1 it works perfectly in my spreadsheet. When I type it in manually it never works correctly?
I have 4 line items for duplicate and I did below formula to find them.
but now for $$ value, I only need one line item (mostly recent line), how can i formula this?
Formula for duplicate: =COUNTIFS($A$2:$100,@A:A)
For amount, I need last row from four duplicates.
AMT:
7000
7000
-7000
7000
Hi!
To find the position of the last match in the list, use the XMATCH function
=XMATCH(C1,A1:A10,0,-1)
Hope this is what you need.
Hi,
please how can I highlight/identify the differences in duplicated values in multiple rows,
I have a sheet of 100k with duplicates and I want to identify the difference between the duplicates within multiple rows.
Thank you
Hi!
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.
I'm working on Excel spreed sheet of 120,000 rows with 6 columns. There are many duplicates that I don't want to delete. Rather, I want to re-edit the duplicate to make them unique.
Please, which formula can I use to extract these duplicates and edit them?
Thank you.
Hi!
Read the paragraph above - How to filter duplicates in Excel.
To highlight duplicate values in a column or range, you can use Excel Conditional Formatting. Read this guide.
You can also use the Duplicate Remover to quickly find and copy duplicates to a separate sheet.
Can you use an extended Countif function to count the number of rows between the 1st same cell value and the 2nd same cell value in a given row, of, say, a known row count value?
A1. 1
A2. 2
A3. 5
A4. 6
A5. 1
The value I would need is Cell A5 - Cell A1 = 4, since I am looking for duplicate values of 1.
Thanks.
Hello!
To search column B for the desired value and get the corresponding value from column A, use the INDEX MATCH functions and this tutorial: How to use INDEX and MATCH in Excel.
For example:
=INDEX(A1:A10,MATCH(B1,B2:B10,0))
I have a list of over 2000 names and want to find out if there are any that have at least one duplicate but I only want the first duplicate reported.
For Example: if I have a list of last names that includes: Smith, Jones, Jackson, Johnson, Cottrill, Fee, Jackson, Zant, Zenner, Jones, Fee, Jackson, Jones, Smith, Sbory, Smith
I want the report to tell me that I have 3 duplicates not 9 (So only counting the first time it hits a duplicate and ignore the rest)
What is that formula?
Thank you!
So in further reading of this I think what I am trying to find out is how to count only the 2nd occurrence of the piece of data within a range.
Hello!
Get a list of duplicates as described in the article above and apply the UNIQUE function.
Please check the formula below, it should work for you:
=COUNTA(UNIQUE(FILTER(A1:A20,COUNTIF(A1:A20,A1:A20)>1,"")))
I have a table A1 Date , B1 Spare parts, C1 P/N,D1 S/N, E1 Total Hours, and sometimes the column P/N duplicate in different dates and total hours, for example at 1/7/22 P/N SHR123 has been installed at total hours 45822:35 and the same P/N installed at 25/7/22 at total time 45970:15 then i want to calculate the two different total times between two dates.
Hi!
I don't really understand what you want to do, but I hope it's helpful.
To convert the text 45822:35 to a date and time, use the formula
=LEFT(E1,SEARCH(":",E1)-1)/24+RIGHT(E1,2)/24/60
More explanations and examples can be found here: How to convert text to date and number to date.
thank you sir, I'll clear my question.... I working at Airlines Co. and I'm following the aircraft's hours and spare parts, so i have a table consists of Columns (A, B, C, D, E,) its titles are: (Date , Spare parts, P/N, S/N, and Total Hours), and sometimes the P/N of any spare parts is duplicate at a different dates and total hours, for example at 1/7/22 P/N SHR123 has been installed at total hours 45822:35 and the same P/N installed at 25/7/22 at total time 45970:15 then I want to calculate the two different total times between two dates
Hi!
I am not sure I fully understand what you mean. What does the phrase "two different total times between two dates" mean? What result do you want to get from your data?
I'm sorry sir i mean subtract (minus) between tow total hours 45822:35 & 45970:15 which the spare part P/N SHR123 has been installed at a different dates 1/7/22 & 25/7/22.
Note: sometimes the P/N install and remove and install again so, i find duplicate more than twice with a different hours and different dates, then i want to subtract between the first install and the second install by minus the two total hours for the same duplicate P/N.
Hi!
Convert the text 45822:35 & 45970:15 to a date and time as I recommended earlier. Then calculate the date difference between these two numbers (in days, hours and minutes).
To calculate in hours, use this formula -
=LEFT(E1,SEARCH(":",E1)-1)+RIGHT(E1,2)/60
Thanks Sir, let me ask another question ......
How can I subtract two cells in a column depending on duplicate cell in another column?
Hi!
To conditionally subtract cells, use the IF function.
I have multiple sheets. On sheet 1, I have a list of names in column D. If the name is coming up for the first time in column D, I need column E to say Yes. If column D is not the first occurrence, I need column E to say N/A. Then, sheet 2 needs to check if there are duplicates in the previous sheet. If the name shows up in the previous sheet, column E should say N/A. If it's the first occurrence, column E will say yes. Sheet 3 will check sheet 1 and 2, same rules apply. If there a formula I can use for that?
Hi!
The answer to the first question can be found in the first paragraph of this article.
=IF(COUNTIF(D:D, D2) > 1,"N/A","Yes")
I recommend using the instructions and example below: Compare 2 columns to find duplicates using Excel formulas.
I hope I answered your question. If something is still unclear, please feel free to ask.
Hello,
I am preparing my salary file in Excel and we have different sites and locations. Employees are often transferred from one location to another. We have 2 modes of payment - 1 official through payroll and some part as cash incentive for job completed.
The accountant many a times forgets to delete the name from one location when he is transferred to some other site wherein he adds him again, this results in duplication of payment.
Can you please help me the way to find out on how to check whether one particular person is not there in any other site.
Will be waiting to hear a fruitful reply on the above
Hello!
You can compare two sheets or tables for matches using the Duplicate Remover Toolkit. 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 and thank you for your helpful tutorial.
I have column A with duplicate data.
To copy column A to B and leave the first occurrence
I have entered the formula =IF(COUNTIF($C1:$C$7, $C1)>1, "", A1)
Column C has various unique texts
With this formula all occurrences appearing at the last row e.g: 280 at row 3 and 150 at row 7
How do I get them at the first row e.g: 280 in row 1 and 150 at row 4?
I have tried to change the >1 to 0 and <0 but it doesn't work
I am using excel 2003
Hereunder The result I get
A B C
1. 280 Red
2. 280 Red
3. 280 280 Red
4. 150 Green
5. 150 Green
6. 150 Green
7. 150 150 Green
Regards
Hello!
Try a nested IF function.
If I understand your task correctly, try the following formula:
=IF(COUNTIF($C1:$C$10, $C1)>1, IF(COUNTIF($C$1:$C1, $C1)=1, C1,""), "")
Hi Alex!
Thank you for sharing all of this formula. it is very helpfull. i got some question;
how to count the total of duplicate item? for example;
i know that there is a total of 4 duplicate bananas, 3 duplicate orange, 6 duplicate grapes & so on.. but how do i calculate how many fruits that has duplicate quantity?
Thank you in advance!
Hello!
I think that your problem cannot be solved with a single formula. If column A contains items, column B contains the number of duplicates, then try the formula:
=IFERROR(ROWS(UNIQUE(FILTER(A2:A10,B2:B10>1))), 0)
Try to use the recommendations described in this article: Count unique values with criteria.
I hope I answered your question. If something is still unclear, please feel free to ask.