calculating the percentage of cells coloured green

dusty

Registered User.
Local time
Today, 01:42
Joined
Aug 20, 2009
Messages
42
I have a range of cells 6 columns 9 rows

which are either coloured red or green depending on the status of a task green completed red uncomplete. I want to be able to use a function/formula/macro to calculate the percentage of cells which are green.

Cheers Dusty
 
You will need an additional cell that queries the column using the same conditional formatting of the cells to sum them. Then use the result to create a percentage.

David
 
With a fixed area the function is quite simple

Code:
Public Function percentgreen() As Double
Dim count As Long

For Each c In Sheets("Sheet1").Range("A1:F9") ' name your correct Sheet and range
If c.Interior.ColorIndex = 3 Then                     ' You may have adifferent green than this 
       count = count + 1
End If
Next c
percentgreen = count * 100 / 54  ' you will want to apply rounding here
End Function

Brian
 
Thanks Brian works great

Also thanks Dcrake for your help.
 

Users who are viewing this thread

Back
Top Bottom