View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Mangesh Yadav[_4_] Mangesh Yadav[_4_] is offline
external usenet poster
 
Posts: 101
Default Summing a range if a certain background colour

Its not possible through a simple worksheet formula, here's a UDF which does
it.

Function myCount(countRng, refRng)
myCount = 0
For Each cl In countRng
If cl.Interior.ColorIndex = refRng.Interior.ColorIndex Then
myCount = myCount + 1
End If
Next
End Function

Usage:
=myCount($A$1:$A$10,A1)

You have to count in the range A1:A10. The second argument is the reference
range where you specify that cell which contains the required format.

Mangesh




" Inserting an option button in Word"
soft.com wrote in message
...
I would like to be able to sum the numnber of times the cell background is
red in a range. I would also like to do it separately for the background
colour yellow, and separately for the background colour bright green.

Ideally
I would like to do it without programming code but any solution very

welcome.
I am using Excel 2003

Thanks.