Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I eliminate duplicate entries in an Excel list ?

Status
Not open for further replies.

Jeterdawg

MIS
Sep 2, 2004
3
US
I have a listing of data in Excel, and I want to eliminate duplicate entries within the first couple of columns so that I can format it differently in order to run some macros.
The data looks as so:

User ID User Name Function Menu
xxx xxx, xxx xx 2
xxx xxx, xxx xx 3
xxx xxx, xxx xx 4
yyy yyy, yyy xx 2
yyy yyy, yyy xx 3
zzz zzz, zzz xx 3
zzz zzz, zzz xx 4

I want to eliminate the duplicates of the first two columns and eventually have it look like this:
User ID User Name 2 3 4
xxx xxx, xxx Y Y Y
yyy yyy, yyy Y Y N
zzz zzz, zzz N Y Y

The Y's and N's I can do using VLOOKUP's, but I have a MASSIVE amount of data, and going through to eliminate all manually would probably take all day...not to mention suffer alot of human error! Any help would be greatly appreciated. Thanks!

 
I found a temporary solution for this issue using an Excel macro and sorting. I inserted a column in front of all the data, and basically wrote a conditional that says if the row following this one is the same, mark it as "x" and go on down the list. Then I sorted and deleted all rows with an "x." Here is the VBA code I used for the macro:

Do Until ActiveCell.Value = "Done"
If ActiveCell.Offset(0, 1).Value = ActiveCell.Offset(1, 1).Value Then
ActiveCell.Offset(1, 0).Value = "x"

ActiveCell.Offset(1, 0).Select

Else
ActiveCell.Offset(1, 0).Select
End If

Loop

End Sub

Feel free to use if this will help. If there is another way to do this that isn't so quick and dirty (emphasis on dirty!), please reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top