0

I want to count the yellow, red and white (no color) cells in a column (range) within a Microsoft Excell sheet. The colors are equal (i.e. only one RGB value of yellow is used, not light/dark yellow etc).

Is this possible?

2
  • 1
    By white you mean the background color white or "no background color"?
    – nixda
    Jan 26, 2013 at 21:55
  • 1
    did you take a look at this? superuser.com/q/328326/14596
    – datatoo
    Jan 26, 2013 at 22:01

1 Answer 1

1

I doubt there is a way with normal Excel functions.
But here is a quick solution using VBA.

  • open your workbook and press ALT+F11
  • insert the code below into sheet1 or where ever your data is
  • customize the Range("A1:A100") to whatever you need
  • close the VBA editor and go back to the sheet with your data
  • press ALT+F8 and execute the macro

    Sub countcolor()
    For Each cell In Range("A1:A100")
        Select Case cell.Interior.ColorIndex
        Case 6: yellow = yellow + 1
        Case 3: red = red + 1
        Case 2: white = white + 1
        Case Else: others = others + 1
        End Select
    Next
    MsgBox "Yellow: " & yellow & Chr(13) _
         & "Red: " & red & Chr(13) _
         & "White: " & white & Chr(13) _
         & "Others: " & others
    End Sub
    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .