CountDuplicates

Counts how many duplicates found in a range of Excel cells.
Basically how many cells that are duplicated in a range of cells in a certain range.
Needs MyRange as Range object to be passed
Helpful was part of some work needed last month
Might needs some work to make it better


Public

Tested

My Own Work
Function CountDuplicates(MyRange As Range)
    CountDuplicates = 0
    For Each cel In MyRange
        If cel.Row > MyRange.CurrentRegion.Rows.Count Then Exit For
        If WorksheetFunction.CountIf(MyRange, cel.Value) > 1 Then CountDuplicates = CountDuplicates + 1
    Next
End Function

MyRange As Range

Views 130 Downloads 37

VBA-Excel Math
ANmarAmdeen
764
Attachments
Revisions

v2.0