#1   Report Post  
Posted to microsoft.public.excel.misc
shakey1181
 
Posts: n/a
Default Colour Count

Having trouble with the above, although the two links posted previously were
helpful in how i should do it [cpearson and xldynamix] but I have been unable
to count cells with a specific colour in them.

I think it maybe my inputting of the VBA code as I am not sure I am doing
this correctly. I have just cut and pasted the code from this site into VBA,
but do not know enough about it to ensure this is right. After inputting the
formula code, when I use it, it is not reconised and returns a NAME error.

Can anyone tell me what I am doing wrong and how to correct it?

http://xldynamic.com/source/xld.Colo...r.html#sorting
  #2   Report Post  
Posted to microsoft.public.excel.misc
Trevor Shuttleworth
 
Posts: n/a
Default Colour Count

Open Excel
Press Alt/F11 together to open VBA
Select Insert | Module from the Menu
Copy all the code from the code samples into the newly created module
(from "ColorIndex Function" down to "End of ColorIndex Function")

Use the examples to test that the function works correctly

=SUMPRODUCT(--(ColorIndex(A1:A100)=3))
counts all red cells (background color) within the range A1:A100

or
=SUMPRODUCT(--(ColorIndex(A1:A100,TRUE)=3))
counts all cells with red text within the range A1:A100

To get the colorindex of a specific cell, simply use
=ColorIndex(A2)


Regards

Trevor


"shakey1181" wrote in message
...
Having trouble with the above, although the two links posted previously
were
helpful in how i should do it [cpearson and xldynamix] but I have been
unable
to count cells with a specific colour in them.

I think it maybe my inputting of the VBA code as I am not sure I am doing
this correctly. I have just cut and pasted the code from this site into
VBA,
but do not know enough about it to ensure this is right. After inputting
the
formula code, when I use it, it is not reconised and returns a NAME error.

Can anyone tell me what I am doing wrong and how to correct it?

http://xldynamic.com/source/xld.Colo...r.html#sorting



  #3   Report Post  
Posted to microsoft.public.excel.misc
shakey1181
 
Posts: n/a
Default Colour Count

This works ok, however it doesn't recount when I change any of the cells
colour, is there a seperate thing I have to do?

"Trevor Shuttleworth" wrote:

Open Excel
Press Alt/F11 together to open VBA
Select Insert | Module from the Menu
Copy all the code from the code samples into the newly created module
(from "ColorIndex Function" down to "End of ColorIndex Function")

Use the examples to test that the function works correctly

=SUMPRODUCT(--(ColorIndex(A1:A100)=3))
counts all red cells (background color) within the range A1:A100

or
=SUMPRODUCT(--(ColorIndex(A1:A100,TRUE)=3))
counts all cells with red text within the range A1:A100

To get the colorindex of a specific cell, simply use
=ColorIndex(A2)


Regards

Trevor


"shakey1181" wrote in message
...
Having trouble with the above, although the two links posted previously
were
helpful in how i should do it [cpearson and xldynamix] but I have been
unable
to count cells with a specific colour in them.

I think it maybe my inputting of the VBA code as I am not sure I am doing
this correctly. I have just cut and pasted the code from this site into
VBA,
but do not know enough about it to ensure this is right. After inputting
the
formula code, when I use it, it is not reconised and returns a NAME error.

Can anyone tell me what I am doing wrong and how to correct it?

http://xldynamic.com/source/xld.Colo...r.html#sorting




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count filled colour in cell in given range [email protected] Excel Discussion (Misc queries) 2 May 16th 06 10:18 AM
Count consecutive dates only [email protected] Excel Discussion (Misc queries) 0 May 4th 06 03:58 PM
Count by Colour (Text) with other criteria Paul Sheppard Excel Discussion (Misc queries) 1 January 18th 06 03:41 PM
How can I count cells of a specific colour (pattern)? Nick@Durham Excel Worksheet Functions 1 November 29th 05 10:18 AM
Formula to count Cell colour. themax16 Excel Discussion (Misc queries) 3 May 29th 05 01:41 PM


All times are GMT +1. The time now is 10:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"