How do you count duplicates instances excluding the first occurrence?

199 comments to "How to find duplicates in Excel: identify, highlight, count, filter, and more" Older Comments osama fawzy says:August 3, 2022 at 2:29 pmI have a table A1 Date , B1

How do you count duplicates instances excluding the first occurrence?

199 comments to "How to find duplicates in Excel: identify, highlight, count, filter, and more" Older Comments

osama fawzy says:August 3, 2022 at 2:29 pm

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.Reply

Alexander Trifuntov (Ablebits Team) says:August 4, 2022 at 7:10 am

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.Reply

osama fawzy says:August 4, 2022 at 3:39 pm

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 datesReply

Alexander Trifuntov (Ablebits Team) says:August 5, 2022 at 8:44 am

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?Reply

osama fawzy says:August 6, 2022 at 3:45 pm

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.Reply

Alexander Trifuntov (Ablebits Team) says:August 8, 2022 at 8:50 am

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)/60Reply

osama fawzy says:August 8, 2022 at 9:23 am

Thanks Sir, let me ask another question ......
How can I subtract two cells in a column depending on duplicate cell in another column?

Alexander Trifuntov (Ablebits Team) says:August 8, 2022 at 12:00 pm

Hi!
To conditionally subtract cells, use the IF function.

Carol says:July 27, 2022 at 4:47 am

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?Reply

Alexander Trifuntov (Ablebits Team) says:July 27, 2022 at 7:58 am

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.Reply

Murtaza says:July 23, 2022 at 1:10 pm

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 aboveReply

Alexander Trifuntov (Ablebits Team) says:July 25, 2022 at 11:55 am

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.Reply

julia says:July 9, 2022 at 6:13 pm

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

RegardsReply

Alexander Trifuntov (Ablebits Team) says:July 11, 2022 at 11:23 am

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,""), "")Reply

izzat says:June 19, 2022 at 8:21 am

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!Reply

Alexander Trifuntov (Ablebits Team) says:June 20, 2022 at 12:43 pm

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.Reply

David says:June 13, 2022 at 1:41 pm

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.Reply

Alexander Trifuntov (Ablebits Team) says:June 13, 2022 at 2:18 pm

Hi!
Unfortunately, Excel formulas can only work with values that are written to cells.Reply

Doris says:March 24, 2022 at 10:46 am

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!Reply

Alexander Trifuntov (Ablebits Team) says:March 24, 2022 at 12:09 pm

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.Reply

dan says:March 4, 2022 at 4:16 am

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.Reply

Alexander Trifuntov (Ablebits Team) says:March 4, 2022 at 8:55 am

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.Reply

Hello says:February 18, 2022 at 6:13 am

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?Reply

Alexander Trifuntov (Ablebits Team) says:February 18, 2022 at 9:05 am

Hi!
Excel formulas do not work with PDF files. The UNIQUE function get unique values in only one data range.Reply

ANAR says:February 16, 2022 at 7:26 am

HI.
I want to compare two rows of number,find duplicate,but not triple numbers,only two same numbers,not more.
please help.Reply

Alexander Trifuntov (Ablebits Team) says:February 16, 2022 at 8:07 am

Hi!
If I understand your task correctly, try the following formula from the first paragraph:

=COUNTIF(A:A, A2)=2

I hope itll be helpful.Reply

Shoaib Akbar says:January 31, 2022 at 12:45 pm

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.Reply

Alexander Trifuntov (Ablebits Team) says:January 31, 2022 at 1:44 pm

Hello!
Please have a look at this article - Extract unique values that occur only once.Reply

Sean Soo says:December 31, 2021 at 4:39 am

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?Reply

Alexander Trifuntov (Ablebits Team) says:January 4, 2022 at 9:42 am

Hello!
Here is the article that may be helpful to you: How to highlight duplicates in ExcelReply

Kassam says:December 11, 2021 at 7:15 pm

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. ThanksReply

Alexander Trifuntov (Ablebits Team) says:December 13, 2021 at 9:04 am

Hello!
To change formulas in multiple cells at the same time, you can use the Find & Replace tool. Replace ", M121" with an empty string.Reply

Ricardo says:November 29, 2021 at 12:16 pm

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?Reply

dennis chua says:November 22, 2021 at 8:03 am

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.Reply

Alexander Trifuntov (Ablebits Team) says:November 22, 2021 at 10:08 am

Hi!
With the Compare Multiple Sheets tool, you can find and highlight differences across multiple sheets.Reply

Bathinda Helper says:November 10, 2021 at 1:26 pm

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.Reply

Alexander Trifuntov (Ablebits Team) says:November 11, 2021 at 7:06 am

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.Reply

Sabbir Mhamud says:November 4, 2021 at 6:24 am

How can i find the duplicate cell in different rows and multiple column?
and delete them?Reply

Alexander Trifuntov (Ablebits Team) says:November 4, 2021 at 8:27 am

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.Reply

Mark Anthony Lanzaderas says:October 28, 2021 at 11:49 am

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.Reply

Alexander Trifuntov (Ablebits Team) says:October 28, 2021 at 12:42 pm

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.Reply

Justin says:August 11, 2021 at 8:21 pm

Thank you so much this was such a huge help!Reply

Clarence Nicole Babatid says:August 2, 2021 at 6:52 pm

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 YellowReply

collins says:July 29, 2021 at 11:22 am

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
1759DD447381Reply

Alexander Trifuntov (Ablebits Team) says:July 29, 2021 at 12:23 pm

Hi!
What does "separate the duplicate" mean? Have you tried the ways described in this blog post? If they dont work for you, then please describe your task in detail, Ill try to suggest a solution.Reply

collins says:August 2, 2021 at 7:21 am

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?Reply

Alexander Trifuntov (Ablebits Team) says:August 2, 2021 at 1:56 pm

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.Reply

collins says:August 3, 2021 at 11:22 am

ThanksReply

niki says:July 21, 2021 at 8:44 am

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!Reply

Alexander Trifuntov (Ablebits Team) says:July 21, 2021 at 8:59 am

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.Reply

Niki says:July 21, 2021 at 10:15 am

You're Godsent. Got why it errors. I doubled the multiplication in the formula. Thanks so much! :)Reply

Sajid says:July 12, 2021 at 3:54 pm

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.Reply

Alexander Trifuntov (Ablebits Team) says:July 13, 2021 at 6:47 am

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.Reply

Cavin says:June 26, 2021 at 5:14 pm

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 MCIReply

Alexander Trifuntov (Ablebits Team) says:June 28, 2021 at 9:20 am

Hello!
You cannot do this with a formula. Use Duplicate Remover.Reply

Placido Vicente says:May 13, 2021 at 5:43 pm

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.Reply Older Comments

Post a commentClick here to cancel reply.    

Thank you for your comment! When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to your query. We cannot guarantee that we will answer every question, but we'll do our best :)

Placido Vicente says:May 13, 2021 at 5:43 pm

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.Reply

Video liên quan