View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
WisconsinGreg WisconsinGreg is offline
external usenet poster
 
Posts: 1
Default How do I find duplicate entries in a column in an Excel worksheet?

I'm working with over 5,000 lines, so I wanted a simpler fix.
Found it he http://support.microsoft.com/default.aspx/kb/213355

I've never used a Macro before, but found it was easy to do by following
these steps taken from Excel help:
1. On the Tools menu in Microsoft Excel, point to Macro, and then click
Visual Basic Editor.
2. On the Insert menu, click Module.
3. Type or copy your code into the code window of the module.
4. In the module window, press F5. (Before pressing F5 be sure you've
selected the first line of the column you want to check for duplicates--in
Excel.)

(Copy and paste the following Macro into Visual Basic, and press F5.)

Sub FindDups ()
'
' NOTE: You must select the first cell in the column and
' make sure that the column is sorted before running this macro
'
ScreenUpdating = False
FirstItem = ActiveCell.Value
SecondItem = ActiveCell.Offset(1, 0).Value
Offsetcount = 1
Do While ActiveCell < ""
If FirstItem = SecondItem Then
ActiveCell.Offset(Offsetcount,0).Interior.Color = RGB(255,0,0)
Offsetcount = Offsetcount + 1
SecondItem = ActiveCell.Offset(Offsetcount, 0).Value
Else
ActiveCell.Offset(Offsetcount, 0).Select
FirstItem = ActiveCell.Value
SecondItem = ActiveCell.Offset(1,0).Value
Offsetcount = 1
End If
Loop
ScreenUpdating = True
End Sub

F5 runs the macro script, and your duplicate lines should be marked in red.
Good Luck!

"Chunka" wrote:

I am working with Excel 2000. I have two columns. Column A contains a
Procedure number and column B contains the associated fee. Each procedure
should only be represented once. My goal is to identify instances where a
procedure is repeated (duplicate entries), so that I can determine which
entry is correct. If you are familiar with Access, I am basically trying to
achieve in Excel, the same thing that a "Find Duplicates" query does in
Access.