how to count number of highlighted cells in column

G

Guest

Within an existing worksheet I have a column of data containing cells that
are either highlighted in yellow (manually highlighted) or not highlighted in
yellow. I need to sum how many cells are highlighted in yellow and how many
cells are not highlighted in yellow. I'm running MS Office Excel 2003 SP2.
 
D

Dave Peterson

You're going to have to use some VBA.

Chip Pearson explains it:
http://cpearson.com/excel/colors.htm

As alternative.
Add an extra column and put an indicator in that column (X). Then use
format|Conditional formatting to make it look pretty. But use that indicator
column in you calculations (=countif() or = sumif() or ...).
 
G

Guest

Mike

With xl2003 it has to be done with VB. Here's one way, you have to select
the range then run it.

Sub TestColor()
Application.ScreenUpdating = False
x = Selection.Cells.Count
For Each c In Selection
c.Select
If Selection.Interior.ColorIndex = 6 Then
Count = Count + 1
End If
Next
Application.ScreenUpdating = True
MsgBox Count & " coloured cells"
MsgBox x - Count & " Non coloured Cells"
End Sub

Regards
Peter
 
G

Gord Dibben

Mike

Without using VBA..........

Select the entire range of colored/non-colored cells.

Edit>Find>Options>Format. Click the dropdown arrow and hit Format.

Select the yellow color from the patterns dialog and OK.

Then Find All.

The first yellow cell will be highlighted in the Find dialog.

Scroll down to bottom and hit Shift + click to select all in dialog box.

In the status bar right-click and select Count.


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top