第1个回答 2012-09-07
在另一列输入=countif(A$1:A1,A1),回车,当鼠标在单元格的右下角出现十字时双击,出现的1234------即是相同的次数第几次,或者输入=COUNTIF(A:A,A2&"*")回车,当鼠标在单元格的右下角出现十字时双击,出现的就是相同的多少个本回答被提问者和网友采纳
第2个回答 2012-09-07
选中数据区域(排除标题),执行 CheckData
Sub CheckData()
If Selection.Count < 2 Then End
Call Sort
dt = CheckRepeat
MsgBox (dt)
dt = CheckInterrupt
MsgBox (dt)
End Sub
Sub Sort()
Selection.Sort Key1:=Cells(Selection.Row(), Selection.Column()), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
:=xlPinYin, DataOption1:=xlSortNormal
End Sub
Function CheckRepeat() As String
dt = ""
c1 = 1
For Each rg1 In Selection
cf = 0
c2 = 1
For Each rg2 In Selection
If c2 > c1 Then
If rg1 = rg2 Then cf = cf + 1
End If
c2 = c2 + 1
Next
If cf > 0 Then
If InStr(1, dt, rg1) = 0 Then
dt = dt & rg1 & " 有 " & cf & " 个重复数据" & Chr(13)
End If
End If
c1 = c1 + 1
Next
If dt = "" Then dt = "没有重复数据!"
CheckRepeat = dt
End Function