Count by Colour in Excel | VBA Formula Trick | Excel Tips in Tamil

 



Count by Colour in Excel 



Function CountByColor(rng As Range, clrCell As Range) As Long

    Dim c As Range

    Dim count As Long

    count = 0

    

    For Each c In rng

        If c.Interior.Color = clrCell.Interior.Color Then

            count = count + 1

        End If

    Next c

    

    CountByColor = count

End Function


Post a Comment

0 Comments