Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

(80% Discount Ends Soon!)

Remove or Delete Duplicate Values and Entries from Excel










I want to remove a complete row which contains duplicate entries in a
specific column



Rather than using Advanced Filter in order to filter a data set for unique
values, I want to delete all duplicate data.

For example, I have a spreadsheet of email addresses. I have another list of
those addresses from the original, master list that no longer work. I have
merged the two lists so that those non-working e-mail addresses now show as
duplicates. How can I remove those addresses from the master list?



I have a spreadsheet of over 10,000 rows, with 3 columns of data. Most lines
in the spreadsheet are duplicates, but there are a few singles here and
there. I need to do a filter to completely remove BOTH duplicate lines so I
am only left with the single records. Is there a way to do this?



Is there a way (beside writing a macro) to delete if you have identical entries in a column and you want to keep only one copy of that row. For e.g.

A B C
1 2 3
1 4 5

Since there are Two 1's in A i only want to keep one copy of that row.

Thanks in advace for help,


I have two lists of Client Accounts. One with 45,000 rows and the other is 45,800 rows.

All of the 45,000 in Column A is in the 45,800 in Column B.

I only want that 800 unique accounts from Column B.

Doing an If(countif(.. crashes my PC. Is there a better way tro find that 800?

Thanks!


i have a cell in excell that has a string of txt, more like a paragraph. and i want to serch through the string of txt in the cell to make sure there are no duplicates. How would i go about doing this? Sample cell A2, has the the txt "see the dog run. See the dog run. See the dog run." and i want to erase all but the first instance. How would i do that?


I need help to remove duplicate rows based on the following criteria:
Col A = Location (Destination Company Number)
Col B = LotNo (Lot number of the specific product that I ship to many companies)
Col E = ShipNo (Shipment number)
Each shipment may contain items fromm different lots. Each lot may have many shipments. Col C and D may or may not be unique - they are irrelevant.
I need to produce rows where LotNo, ShipNo & Location are unique.
I am attaching a file. 1st tab shows input raw data, 2nd tab shows needed result. The file contains only one location. The actual file file has all locations.
Thank you.


Hey guys, I'm new to these forums. I searched the forums and didn't exactly find what I needed...

Today I was working on some excel spreadsheets and I needed to find and delete duplicates. But Excel 2007 (for some reason) is only able to delete the second duplicate it finds...

For example, if I had:

FILE # VALUE
0930809 2009
0930809 2839
3994843 4857

it would always delete the second entry,
0930809 2839

Is it possible to have it delete the first entry, and not the second one?

I tried sorting it out the opposite way (I had it from smallest to biggest) and it would still remove the wrong duplicate.

Ideas?

Right now I used a formula and copied it all the way down to at least spot the duplicates,
=IF(OR($A3=$A4,$A3=$A2),"same","")
and I'm going manually to remove them. It's getting long though and I have many more to go through.

Thanks a lot,
Quicksand10


I have a drop down list which consists of a huge amount of column. However there are several duplicate entries in the column and it causes my drop down list which refers to that column having duplicate entries also.

How am i able to remove the duplicate so my drop down list will look clean and neat?


I have a report that I'm trying to remove duplicate rows but I was the macro to look all the columns before deleting the entire duplicate row. I have looked at different macros and they delete rows based on one column but that doesn't work for me because in my data a lot of the columns are the same. I just want the ones that are true duplicates to be deleted.


Hey everyone,

I have a long list of around 400 phrases, all in their individual cells. My problem is some of the terms have duplicate words in them.

Here's an example: http://i51.tinypic.com/1ttpg5.jpg

Is there any way to remove this duplicate text from the cell?

Thanks,
Russell


Hi,
I have a large table of data and I am trying to remove the duplicates in a column. I am using Data>Remove Duplicates

This is working fine except that in every case it leave one duplicate pair behind. It deletes the rows containing the duplicates and then below the empty rows there is one row of data containing a one part of a duplicate.

Does anyone know why this is happening?

It's annoying i have to manually remove one row to get rid of all the dupes.


As I tried to explain very short in the title. I want to delete rows that has duplicates but still keep the row with higest number from a cell in the column next to the one being searched for duplicates.

Code:

 
 Looks like this, but I have thousands of rows. 
Where I have about 500 to 1000 uniqe numbers.
 
  |  A  |   B   |
1 | 680 | 832122

Hello all,

I was wondering if anyone knew of a way to do the reverse of the Delete Duplicate Function in Excel on the Data Tab.

Where the function allows you to select column headers to check for, then finds the records that are duplicates and deletes only the duplicate.

I would like a macro that does the opposite, allows me to keep all of the duplicates and delete the unique records only. Leaving me with both of the records that contained the specified column info ("=RC2&""-""&RC3&""-""&RC6").


Hello: I have a plain text data file that contains rows of data - each with 3 columns separated by spaces - that is a dataset for a visualization program (Cytoscape).

The data is of the form

a pi b
a pi c
a pi d
c pi a
etc.

where the first and last columns are genes, and the middle column is the relationship (interaction type) between them.

My problem is that the rows (a pi c) and (c pi a) are informationally equivalent (gene "a" interacts with gene "c" with interaction type "pi"), but both are mapped (displayed) in Cytoscape, adding superfluous redundancy to the visual images, e.g.

a=c (with two lines connecting genes a and c)

and not

a-c (with 1 line connecting genes a and c).

I would like to parse (delete) these duplicate data.

I imported (copied/pasted) the sorted data from Notepad into Excel (into two Excel files - there are ~120,000 rows, which exceeds Excel's maximum number of rows by ~2X), but I cannot figure out how to delete these duplicates.

I thought that if I reversed the order of the cells - the "reverse complement," i.e. (a pi b) converted to (b pi a) then combined the starting and transposed list, that I could sort out the duplicates (which I am able to do), but this action also generates new duplicates, a "vicious cycle."

What I really need to have, either in Excel (or a linux script?), is a script that interprets these actions:

for each row of data in the data file
if (reverse complement) = true then delete

That is, look at the list

a pi b
a pi c
a pi d
c pi a

if (b pi a) is present, then delete (a pi b)

and so on. In this example, when the last row is evaluated,

if (a pi c) is present, then delete (c pi a)

this "duplicate" (redundant) entry will be deleted.

Is there a simple way to do (code) this in Excel? And / or a linux script?

I apologize for the length of this message - I wanted to clearly explain the problem. If someone could provide a solution, I would really appreciate it! Sincerely, Greg S. :-)


Does anyone know how to remove duplicate email addresses from either excel or word?

I would like to send our customers a newsletter but not aggravate them by not filtering out their email addresses which appear more then once in our database. Any suggestions?


what i am trying to do is to delete duplicate rows, but not just in the ordinary fashion. I want to search for duplicates based on cell contents in column A and C and then delete whichever duplicate contains the phrase "discontinue" in column E

So, if the contents in column A and C match for two rows then I want the macro to look to column E and delete whichever duplicate contains the word "discontinue"

I searched the forums and only found regular delete duplicates macros and nothing that will do just this.

Thanks for any help!


Hi. I have Windows XP, Microsoft Office 2003 (Excel 2003)



I have over 20,000 items that I must sort through. I am dealing with book titles and need to sort them by how many times each book has been checked out. But there are often several copies of books so I need to do the following in excel: identify the duplicates sum up the total for the duplicate copies of the same book delete the copies and leave only one line with the book name/author/and now TOTAL number of checkouts Here is a sample of what my data looks like:

Column A______________________ Column B_________ Column C
Title Author Checked Out
1 gaping wide-mouthed hopping frog ___Tryon, Leslie ________114
4 pups and a worm __________________Seltzer, Eric ________135
A bade case of stripes _______________Shannon, David _____102
A bargain for Frances ________________Hoban, Russell ______131
A bargain for Frances ________________Hoban, Russell ______107
A bargain for Frances ________________Hoban, Rusell _______102
A bear for all seasons ________________Fuchs, Diane _______103
A bear for all seasons ________________Fuchs, Diane_______ 102


There are two duplicates for "A bargain for Frances" and one duplicate for "A bear for all seasons. Here is what I would like for it to look like:

Column A ____________Column B ___________Column C
A bargain for Frances ____Hoban Russell __________340
A bear for all seasons ____Fuchs, Diane___________ 205

Is there a way to do this? I know how to do it manually through the Conditional Sum Wizard but I have so many items that it would take literally forever. Is there a way to have excel to do in one shot? Some kind of formula?

If you guys can, please provide instructions step by step...in the past I have used excel for only very general things. So writing formulas, even COUNTIF or SUMIF was totally new to me as of only a few weeks ago.

thank you so much for your help!
Irina

Hi. I have Windows XP, Microsoft Office 2003 (Excel 2003)


I have over 20,000 items that I must sort through. I am dealing with book titles and need to sort them by how many times each book has been checked out. But there are often several copies of books so I need to do the following in excel:
identify the duplicates sum up the total for the duplicate copies of the same book delete the copies and leave only one line with the book name/author/and now TOTAL number of checkouts Here is a sample of what my data looks like:

Column A________________________Column B_______Column C
Title Author Checked Out
1 gaping wide-mouthed hopping frog______Tryon, Leslie_________114
4 pups and a worm____________________Seltzer, Eric__________135
A bade case of stripes_________________Shannon, David_______102
A bargain for Frances__________________Hoban, Russell________131
A bargain for Frances__________________Hoban, Russell________107
A bargain for Frances__________________Hoban, Rusell_________102
A bear for all seasons__________________Fuchs, Diane_________103
A bear for all seasons__________________Fuchs, Diane_________102


There are two duplicates for "A bargain for Frances" and one duplicate for "A bear for all seasons. Here is what I would like for it to look like:

Column A___________________Column B_____________Column C
A bargain for Frances____________Hoban Russell______________340
A bear for all seasons____________Fuchs, Diane______________205

Is there a way to do this? I know how to do it manually through the Conditional Sum Wizard but I have so many items that it would take literally forever. Is there a way to have excel to do in one shot? Some kind of formula?

If you guys can, please provide instructions step by step...in the past I have used excel for only very general things. So writing formulas, even COUNTIF or SUMIF was totally new to me as of only a few weeks ago.

thank you so much for your help!
Irina


I have a spreadsheet with content IDs in the first column.

I want to analyze rows with duplicate content IDs. The other columns are not the same so the rows are not exact duplicates.

I need a formula or macro that will hide or delete rows with unique, non-duplicate values in the first column. Any suggestions?


Hello All,

I am trying to think of the best way to implement this process. I believe a LEFT SEARCH will be best but please let me know if this is possible.

In column A I have a few different web addresses that end in .com, .edu, .org etc. After the domain extension is a really long web address. Is there any way I can have a formula in Column B that looks at the web address in column A and shortens the URL to that domain extension like .com, .edu etc?

All:

I have been trying to find a way to get this to work but have been unsuccessful. What I am trying to get is a message box to pop up if a value is entered more than once in column A. After the user views the box and clicks ok, I would for the second instance of the value to be deleted from the worksheet.

Any help is greatly appreciated!

I am trying to delete the duplicate records in an Access database.
In the code below, all the records, including duplicates, are inserted in the new tblmyTemp table.

Can anyone please advise where I am going wrong, as I thought DISTINCTROW was intended to remove duplicates.

Any suggestions on how I can get a table without duplicate records?

All help and suggestions very gratefully received.

Code:

Sub Del_Dupes()

' delete duplicate records in a database table

Dim db As DAO.Database, rst As DAO.Recordset
Dim sSQL$

Set db = CurrentDb()
Set rst = db.OpenRecordset("tblTransformer")

sSQL = "SELECT DISTINCTROW INTO tblMyTemp FROM tblTransformer"

DoCmd.SetWarnings False
DoCmd.RunSQL sSQL
DoCmd.SetWarnings True

MsgBox "A table WITHOUT DUPLICATES has been created as tblMyTemp", _
  vbOKOnly, "Created"

Set rst = Nothing
Set db = Nothing

End Sub





Hi,

I'm trying to write a macro that will delete all rows where the value in Column in C is the same as the one above it BUT not if the value is a blank row. Here's what I have but it keeps erroring on me....can anyone tell me what I'm doing wrong. Thanks!

Do Until lastrow = 1
If Cells(lastrow, 3).Value "" Then
If Cells(lastrow, 3).Value = Cells(lastrow - 1, 3).Value Then
Rows(lastrow).Delete
End If
End If
lastrow = lastrow - 1




Hello!

I have a table that contains data from columns A:H.

Column B is a Date Field (Short Date Format= mm/dd/yyyy)
Column C is an alpha numeric field (Text Format)

There can be duplicate values in column C, but each record will have a different date. For Example, let's say I have the following records:

Row # Column B Column C

1 03/25/2013 11030
2 05/07/2013 11030
3 07/01/2013 11030

In this example, I want to only keep Row #3 as this record has the most recent date. The number "11030" has been duplicated 3 times. So my criteria for deleting duplicates is to keep the duplicated record which has the most recent date and this code needs to cycle through the data set to find the duplicates and ONLY keep the most recent date. Something to keep in mind while developing this code: I have seen 2-6 duplicate records. Please help! I do not want to have to do this manually by hand as there's thousands of records to go through! Any help will be greatly appreciated.