Conditional Formatted Cell Color Index

G

Guest

I need a little help in how to determine the color index of a cell that is
formatted with ondition formatting.

The spreadsheet formats the color of the cells to RED, Yellow, Or Green with
conditional formatting and I need to be able to count the number of Cells in
a range that are green. The cells interior color index properity does not
give me the color value when conditional formatting is used.

Im using EXCEL 2002 SP3
 
B

Bob Phillips

Not easy, but Chip has a function at his site
http://www.cpearson.com/excel/CFColors.htm

IMO, it is better to count the conditions that force the colour. SO for
instance, if the cells are green if the value is > 10 then use

=COUNTIF(A1:A100,">10")

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
G

Guest

if you are writing a maco, instead of checking for interior color, you could
check for the conditions you use to format. eg if a cell value of 4 -
10 = green interior
then search for cells with a cell value of 4 - 10 and that = your amount of
green cells
 
G

Gys

Hi,
this function returns the color code of a cell

Function CellColorCode(MyCell As Range) As Single
'
'Gys Nov-2004
'Function produces the Color Code of a Cell
'A Pivot Table can be used to count colored Cells
'
CellColorCode = MyCell.Interior.ColorIndex
'
End Function
 
B

Bob Phillips

The OPs cells are coloured by conditional formatting. This routine will not
determine that colour, as the OP says, the ColorIndex property is not set by
CF.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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