Removing duplicate cells/rows in excel

I have a spreadsheet with 1,000 rows.
Each row has a persons name (e.g. James J Smith) as the
first cell.
There are multiple entries for a single person (e.g. James
J Smith). The first entry found is the one with the latest
data.

I need to remove all the duplicate rows for a single person
so that I end up with one entry per person that is the
first one found in the spreadsheet.
What is the best way of doing this?



0
anonymous (74717)
2/6/2004 8:49:32 AM
excel.misc 78881 articles. 5 followers. Follow

2 Replies
468 Views

Similar Articles

[PageSpeed] 55

Hi Joe,

A macro would probably be the most efficient way, though would could do it
manually using an oldest>newest sort and conditional formatting to highlight
duplicates and deleting highlighted rows from oldest to newest, one at a
time. Done properly, the highlighting would disappear from the remaining
rows as their duplicates are deleted.

Here's a macro solution:

Sub DeleteDuplicateRows()
Dim lLastRow As Long, lLastCol As Long
Dim I As Long, J As Long, K As Long
lLastRow = ActiveSheet.UsedRange.Rows.Count - 1
lLastCol = Selection.Columns.Count - 1
 For I = 0 To lLastRow - 1
  For J = lLastRow To I + 1 Step -1
   For K = 0 To lLastCol
    If ActiveSheet.Range("A1").Offset(I, K).Value <> _
    ActiveSheet.Range("A1").Offset(J, K).Value Then
     Exit For
    End If
   Next K
   If K > lLastCol Then
    ActiveSheet.Range("A1").Offset(J, 0).EntireRow.Delete
   'Else EntireRow.Hidden = False
   End If
  Next J
 Next I
End Sub

Note: this macro is case sensitive and requires you to select the column(s)
on which the duplicates comparison is to be done.

Cheers


"Joe90" <anonymous@discussions.microsoft.com> wrote in message
news:ade101c3ec8e$23f64880$a101280a@phx.gbl...
> I have a spreadsheet with 1,000 rows.
> Each row has a persons name (e.g. James J Smith) as the
> first cell.
> There are multiple entries for a single person (e.g. James
> J Smith). The first entry found is the one with the latest
> data.
>
> I need to remove all the duplicate rows for a single person
> so that I end up with one entry per person that is the
> first one found in the spreadsheet.
> What is the best way of doing this?
>
>
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.576 / Virus Database: 365 - Release Date: 30/01/2004


0
2/6/2004 9:41:10 AM
Hi 
have a look at
http://www.cpearson.com/excel/deleting.htm#DeleteDuplicateRows

Frank


Joe90 wrote:
> I have a spreadsheet with 1,000 rows.
> Each row has a persons name (e.g. James J Smith) as the
> first cell.
> There are multiple entries for a single person (e.g. James
> J Smith). The first entry found is the one with the latest
> data.
> 
> I need to remove all the duplicate rows for a single person
> so that I end up with one entry per person that is the
> first one found in the spreadsheet.
> What is the best way of doing this?


0
frank.kabel (11126)
2/6/2004 10:54:37 AM
Reply:

Similar Artilces:

Remove Excel Icon ??
Hi, I would like to remove the possibility to export data in Excel. I think I already read it's impossible but I just want to confirm. Thanks, Sylvie Your correct, there is no supported way to do this in the current release of Microsoft CRM 1.2 -- John O'Donnell Microsoft CRM MVP http://www.microsoft.com/BusinessSolutions/Community/CRMFaqLanding.aspx "sylvie" <sylvie.mondoux@proximi-t.com> wrote in message news:09dd01c47b03$d3627560$a301280a@phx.gbl... > Hi, > > I would like to remove the possibility to export data in > Excel. I think I already rea...

Excel Options
How do you disable the rounding feature in excel (e.g. - I want to display 10/6, and not 5/3 as excel would display)? One way: Format/Cells/Number/Custom ?/6 In article <B77FDD23-4A2D-430D-8375-34F9944CCAAC@microsoft.com>, "todd" <todd@discussions.microsoft.com> wrote: > How do you disable the rounding feature in excel (e.g. - I want to display > 10/6, and not 5/3 as excel would display)? text format Thanks for the help. Let me take this question one step further. I want to create a bar graph that displays the fractional value taken from a table...

Removal
How do I completely remove all traces of Outlook 2002 for a complete fresh reinstall. I can't find anything for '02. HELP!!!!!!!!!!!!!!!!! ...

how do I remove spaces from cells that were pasted
I am pasting numbers into a spreadsheet, however its treating them as text because there is a space before the number. How do I remove the space so it treats it as a number ? I have used the =trim() function and its not working. Thanks for any help ! Hi! It sounds like you're copy/pasting from a website. Try this macro from David McRitchie. Look for TRIMALL, it's about half way down the page: http://www.mvps.org/dmcritchie/excel/join.htm Biff >-----Original Message----- >I am pasting numbers into a spreadsheet, however its treating them as text >because there is a...

Remove lines with +++
Is there anyway to find any line that has a + in it and delete that whole line?! I'd also like to do the same for *. I have a list of about 1300-1500 names and addresses. Some of them have a few +++ next to the name and some of them have a few *** next to the name. These were put there by the company to designate things. They need to be removed from the list, but it's a lost of work doing it one by one. You could apply an autofilter to the column with these characters in and from the pull-down select Custom - in the panel choose "Contains" (scroll down for this) the...

Excel "forgetting" its add-ins
There is nothing more annoying than having to reinstall the stupid Solver or other add-ins (such as regression) after not using them for a while! I teach the same class every Spring and every late January or early February I need to check a homework problem on my laptop here and there. And every year, the same damn story, I have to insert some stupid disk, which I don't have with me on a trip. I specifically remember doing THE COMPLETE INSTALLATION of the stupid Office software on my machine precisely to avoid this problem, because this incredible annoyance and frustrat...

Non-positional cell formulas?
Ok, I have a spreadsheet with multiple columns, for example: Date | spanning header1 | spanner header2 | spanning header3 | Average header | | subhead1a | subhead1b | subhead2a | subhead2b | subhead3a | subhead3b | | date | s1adata | s1bdata | s2adata | s2bdata | s3adata | s3bdata | average s1a,s2a,s3a | Now for every row, I need to calculate the subtotal data. No problem with the formula (like in =AVERAGE(B3,D3,F3)). The next line's formula would be =AVERAGE(B4,D4,F4). The problem ...

Shortcuts of excel
I want to perform a "horizontally page down" , switch from column 1 to column 50 . are there any shortcut keys perform such action? are there any article listing all the shortcut key of excel? thank you. "Page across" is Alt+PageDown. To page back towards the A column again you do Alt+PageUp. If you look in Excel Help you should be able to find a list of shortcut keys (it was there up to Excel 2000). Regards David "cclai" <chichung15@hotmail.com> wrote in message news:e7H2C9PqDHA.1020@TK2MSFTNGP09.phx.gbl... > I want to perform a "horizontal...

3 hole punched paper and excel spreadsheets
Help! Excel non-user needs to know how to set up spread sheets to shift tables to print on 3 hole punced paper. Our Excel guru is out having a baby! Can You help? Running Excel 2002. Thanks, Carl *** Sent via http://www.automationtools.com *** Add a newsgroup interface to your website today. On the print preview. Click the margins button. At the top border, there are small black tabs (margin tabs). If you drag the margin tabs over slightly, you may be able to get everything you want on the page. If it doesn't work exit the workbook but don't save the changes. Anywho, make a back...

How to create a shortcut in Excel?
How to create a shortcut in Excel? Hi Vova To a macro? To a sheet? A shortcut on the desktop to a file? Post back with more info and someone can help you -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "Vova" <vcapko@gng.com.ua> wrote in message news:04c701c3cbbe$cc6a9e30$a501280a@phx.gbl... > How to create a shortcut in Excel? Vova wrote: > How to create a shortcut in Excel? One way (Excel 97): Insert >> Hyperlink ...

How to Remove SRS
How to I remove or disable Site Replication Service (SRS) from my Exchange 2003? Thank You, Jason HI Remove the SRS by expanding the Tools node in ESM, right-clicking Site Replication Service, and clicking Delete "jpollock" wrote: > How to I remove or disable Site Replication Service (SRS) from my Exchange > 2003? > > Thank You, > > Jason > > And make sure you are doing it while logged in to the console of the Exchange server on which the SRS is running. -- Jim McBee Web: http://www.somorita.com Blog: http://mostlyexchange.blogspot.com &...

Editing in a cell
I am having a problem with a newly created workbook. When I go to a cell that has data in it and try to add more data to the existing string I lose all the previous information. The work sheet that I am working in is protected and I have "edit directly in cell" checked in the options section. It is almost like my double click (as well as F2) are being treated as a single click. Thank you I figured it out. For some reason "Hide" is selected for the unlocked cells. "John English" wrote: > I am having a problem with a newly created workbook. > > Wh...

allmost done with removing our 1st exchange 03 server
We are in the process of removing the 1st exchange server in our domain. Everything has been replicated over to a new server and all mailboxes have been moved. When we shut down the original server down, email still works great for 90% of the team. For the rest of us, when type the name of person to receive an email, outlook it still tries to resolve the name on the original server. I checked the profile on the users mailbox and it shows them pointing to the new server. Any suggestions would be appreciated. Try creating a new Outlook profile. Also, when you shut down you're...

remove Fax from address book?
Is there a way to stop showing Fax in the address book? I have a lot of fax numbers in my Contacts. I do not want to loose them - just not show them in the Address Book. thx Outlook considers fax numbers to be valid electronic addresses, since there are many client- and server-based components that can use such addresses. One method to hide fax numbers from the address book is to prefix the fax number with one or more letters (maybe B for business fax, H for home, O for other). If the fax number begins with a letter, Outlook won't show it in the address book. There are a couple of t...

Cannot Remove a program from Add Remove via remove.
I downloaded a program Fast At Last and it did not download properly and I could not remove it. Even System Restore did not remove it. The program is listed as 924PL32. Kept getting messages The feature you are trying to use is on a network resource that is unavailable. C:\dell\GC605. Seems Dell is the publisher but they would not give me free support on this issue. Any suggestions as to how I can remove the program? I believe it may be associated with spyware. When I ran spysweeper it removed some Rouge Security products but I still cannot remove this program. Cor...

Removing an item from menu
How can I remove an item from the menu and add some thing else. For instance, how can I remove inactive from the menu in contact page and put some other item with my own code behind it? You can hide the public views by simply creating a team (non used views or whatever you want to name it) and share the view to that team(done in the customize entity fields in the forms and views), this will make it a private view that only members of that team can see. You can also create new public or private views in the same place. "Amin" wrote: > How can I remove an item from the m...

Excel PDF
Does anyoine know is it possible to save a document as a PDF file ? You can save an excel file as a PDF file but you have to have a PDF writer. "Craigv_2000" wrote: > Does anyoine know is it possible to save a document as a PDF file ? Craig For FREE!!! I have had success with the free file downloads and instructions for use here at Dale Nurden's site. http://www.rcis.co.za/dale/info/pdfguide.htm Saves first to single *.ps file which you then convert to *.pdf Returns one PDF file from multiple sheets or selected sheet. Gord Dibben Excel MVP On Mon, 15 Aug 2005 13:16...

code to make a block arrow point from cell A to cell B
Hello, I'm looking for a piece of code to make an existing shape (block arrow) point from one cell to another. I know how to refer to cells and their properties. It's just the shape that I don't know how to handle by vba. Could you give me a hand or a reference? Thanks Is this what you are wanting? Activecell.Value = ChrW(&H25BA) -- Cheers, Ryan "hermac" wrote: > Hello, > I'm looking for a piece of code to make an existing shape (block > arrow) point from one cell to another. I know how to refer to cells > and their propert...

Remove deduction code from payroll stub
Is it possible to remove just a single payroll deduction code from a payroll stub using 'Employee Checks Stub on Top-D'? For example, an employee has three deductions: Insurance, 401k, Medical. Would it be possible then to show insurance and 401k but leave medical off the check stub for all employees who have medical? Thanks in advance for your help! I don't believe so because the deduction field is an array so you'd have to know which array value. Even if you did, I don't think you can use arrays in report restrictions. -- Charles Allen, MVP "drose03...

reformat text in a cell
I have 2000+ cells that look like this: UK00001 Geddy Lee 2112 Bytor Ln GLENVIEW, IL 60025-1522 Is there a simple way to add a space after each line? right now when i paste it into a word doc, it shows like this : UK00001 Geddy Lee2112 Bytor LnGLENVIEW, IL 60025-1522 I would like to REFORMAT every cell to look like this with spaces in between to make it readable: UK00001 Geddy Lee 2112 Bytor Ln GLENVIEW, IL 60025-1522 any suggestions? ...

iNTERACTIVE EXCEL FILE NOT INTERACTIVE ON THE WEB
I have an interactive excel file that is interactive in Dreamerweaver 2004 MX but when I publish it, it quits being interactive. Anybody know why? Thanks! ...

Duplicate e-mail messages 2000 downloaded in outlook, there must be a solution
I recently installed Microsoft Office XP and downloaded all of the service packs and patches to Office (including Outlook 2002). Almost every time I reboot and even sometimes reload outlook, Outlook will keep downloading the same messages into my folders from the e-mail server of each account. I have "leave a copy" on server checked for most of my counts. Is their a solution to this problem? This could be because of firewall settings so that a confirmation of receiving cannot be send back to the smtp server. Disable the firewall for a while and see if the problem is gone. Hope this...

How do I import an excel spreadsheet to a word document #2
I have a saved excel spreadsheets (3 tabs). I want to import this to my Word document so in the word, I can select the three different tabs and also see the formulas. How do I simply do this? And how do I create spreadsheets in word using the excel function? -- Amuse ------------------------------------------------------------------------ Amuse's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=25086 View this thread: http://www.excelforum.com/showthread.php?threadid=385993 ...

How to select other random cells
I have a 2 part question. I want to have a 1 question survey randomly filled out by 200 people. Column A lists the 1 questions. Columun b has ABCDE listed in cells B6 to b10. I would like 200 samples in columns c, d, e, etc. How do I set this up so that they randomly Coose B6 to B 10. Second part. On another spreadsheet, I have a similar situation, but the user has 10 answers to select from and I want them to randomly select all that apply. How would I do this? Thanks! ...

Exporting several xml levels from excel
Hello. I must export data from excel to an xml file using a schema like this: ************************************************* <?xml version="1.0" encoding="UTF-8"?> <data senddate="23/01/2009"> <site code="12345" latitude="56.4517" longitude="11.5431" unitid="1234"> <requireddata catchdate="19/11/2008" numberofspecies="0"> <datatests> <datatest id="1" numspecies="0"/> <datatest id="2" numspecies="0"/> <datate...