ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Count using Coloured Cells (https://www.excelbanter.com/excel-discussion-misc-queries/217084-count-using-coloured-cells.html)

enna49

Count using Coloured Cells
 
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

David Biddulph[_2_]

Count using Coloured Cells
 
If you are getting the NAME error, then I would assume that you haven't
defined ColorIndex.

As ColorIndex is presumably a user defined function, have you defined it?
We don't know to which threads you are referring, as you've started a new
thread rather than replying, but I would recommend that you go back and look
again at what was recommended.
--
David Biddulph

"enna49" wrote in message
...
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




JB

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




All times are GMT +1. The time now is 08:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com