U
User279
How do I create a simple counter to show repeating values?
John Bundy said:Here is a formula from way back that counts uniques, you can change to bring
back duplicates or just subtract the result from the count of cells.
Function CountUnique(ItemList As Range) As Long
' CountUnique counts the number of cells in a range of cells, but only
' counts cells that have duplicates once. Thus it is like the Excel
' COUNT function except that it only counts unique values.
' Written by: Damon Ostrander
' Date: 5/3/01
' Email: [email protected]
Dim nItems As Long
Dim i As Long
Dim j As Long
nItems = ItemList.Cells.Count
CountUnique = 0
For i = 1 To nItems
For j = 1 To i - 1
If ItemList.Cells(i) = ItemList.Cells(j) Then GoTo Duplicate
Next j
CountUnique = CountUnique + 1
Duplicate:
Next i
End Function