Deleting duplicates within rows
I need to delete duplicate cells that occur within a row, and return only the
unique cells. There are 4 colums and almost 7000 rows. Example of rows: 123 Main St Ste 789 123 Main St 987 Elm St 1st Floor 1st Floor Room A 311 West St 311 West St Need to return across multiple cells: 123 Main St Ste 789 987 Elm St 1st Floor Room A 311 West St THANKS! |
Deleting duplicates within rows
In 2007
Select all columns eg a to d where d is col with duplicates On ribbon select 'data' tab<'data tools'<'remove duplicates'< Untick columns a, b,c in new window Tick box for headers if appropriate OK "ComeOn12" wrote: I need to delete duplicate cells that occur within a row, and return only the unique cells. There are 4 colums and almost 7000 rows. Example of rows: 123 Main St Ste 789 123 Main St 987 Elm St 1st Floor 1st Floor Room A 311 West St 311 West St Need to return across multiple cells: 123 Main St Ste 789 987 Elm St 1st Floor Room A 311 West St THANKS! |
Deleting duplicates within rows
I'm sorry - I should have mentioned before that I'm using Excel 2003. Any
ideas for that? Thanks so much! "Arceedee" wrote: In 2007 Select all columns eg a to d where d is col with duplicates On ribbon select 'data' tab<'data tools'<'remove duplicates'< Untick columns a, b,c in new window Tick box for headers if appropriate OK "ComeOn12" wrote: I need to delete duplicate cells that occur within a row, and return only the unique cells. There are 4 colums and almost 7000 rows. Example of rows: 123 Main St Ste 789 123 Main St 987 Elm St 1st Floor 1st Floor Room A 311 West St 311 West St Need to return across multiple cells: 123 Main St Ste 789 987 Elm St 1st Floor Room A 311 West St THANKS! |
Deleting duplicates within rows
You could use a macro:
Option Explicit Sub testme() Dim iRow As Long Dim FirstRow As Long Dim LastRow As Long Dim iCol As Long Dim LastCol As Long Dim wks As Worksheet Set wks = Worksheets("Sheet1") With wks FirstRow = 1 'no headers??? LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For iRow = FirstRow To LastRow LastCol = .Cells(iRow, .Columns.Count).End(xlToLeft).Column For iCol = LastCol To 2 Step -1 If Application.CountIf(.Rows(iRow), _ .Cells(iRow, iCol).Value) 1 Then 'more than one found, delete this one .Cells(iRow, iCol).Delete Shift:=xlToLeft End If Next iCol Next iRow End With End Sub If you're new to macros: Debra Dalgleish has some notes how to implement macros he http://www.contextures.com/xlvba01.html David McRitchie has an intro to macros: http://www.mvps.org/dmcritchie/excel/getstarted.htm Ron de Bruin's intro to macros: http://www.rondebruin.nl/code.htm (General, Regular and Standard modules all describe the same thing.) ComeOn12 wrote: I need to delete duplicate cells that occur within a row, and return only the unique cells. There are 4 colums and almost 7000 rows. Example of rows: 123 Main St Ste 789 123 Main St 987 Elm St 1st Floor 1st Floor Room A 311 West St 311 West St Need to return across multiple cells: 123 Main St Ste 789 987 Elm St 1st Floor Room A 311 West St THANKS! -- Dave Peterson |
All times are GMT +1. The time now is 01:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com