View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
JB JB is offline
external usenet poster
 
Posts: 115
Default Count using Coloured Cells

With UDF in a module:

Function BackColor(MyRange As Range)
Application.Volatile
Dim temp()
ReDim temp(1 To MyRange.Count)
For i = 1 To MyRange.Count
temp(i) = MyRange(i).Interior.ColorIndex
Next i
BackColor = Application.Transpose(temp)
End Function

=SOMMEPROD(--(backcolor(B1:B16)=backcolor(A6)))

http://cjoint.com/?bwk5YwU1mL

JB
http://boisgontierjacques.free.fr


On 20 jan, 07:19, enna49 wrote:
Hi

I have followed the threads for this and still getting an error "NAME?
Using Excel 2007.
I have cells in B1:B17 with numerous colours. *A1 to A7 I have a list
referencing the colour I would like counted. * The formula is in Col D. *This
is the code I am using.

=SUMPRODUCT(--(ColorIndex(B1:B16)=ColorIndex(A6)))

Thanks