Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default COUNTIF: criteria is a format

I have a column with cells that have text of different colors. I'm trying to
count up the number of cells that the text is formatted a particular color.
For example, A1 and A4 are formatted red text, while A2, A3, and A5 are
formatted blue text. I need it to tell me that there are 2 cells with red
and 3 cells with blue. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 109
Default COUNTIF: criteria is a format

It wouldn't be too difficult to write a macro to loop through a range
of cells and count the number of red and blue cells. I am not sure if
you would want to just count red and blue and put the numbers in
specific cells, or keep track of all the colors that are present.

If there is some explainable logic as to why the cells that are red
are red and why the cells that are blue are blue, you may find it more
beneficial to make the cell font turn red or blue through the use of
conditional formatting and do your counting with the same logic in a
cell on the spreadsheet as you have in the "formula" in each of your
conditional format conditions. That would effectively count the red
and blue cells, with out the need for a macro; and it could save some
time in adjusting the font.

Good luck
Ken
Norfolk, Va





On May 14, 6:46*pm, alligatormaki
wrote:
I have a column with cells that have text of different colors. *I'm trying to
count up the number of cells that the text is formatted a particular color. *
For example, A1 and A4 are formatted red text, while A2, A3, and A5 are
formatted blue text. *I need it to tell me that there are 2 cells with red
and 3 cells with blue. *Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15
Default COUNTIF: criteria is a format

Maki,

You can use this UDF next to your data:

Function GetCellColor(r as range) as Integer
GetCellColor = r.font.colorindex
End Function

Now, next to A1 you can enter the formula:

=getcellcolor(A1)

Red is 3, Blue is 5.

You can then count red cells with a formula like:
=COUNTIF(B:B,3)

HTH
Kostis Vezerides


On 15 Μάϊος, 01:46, alligatormaki
wrote:
I have a column with cells that have text of different colors. Â*I'm trying to
count up the number of cells that the text is formatted a particular color. Â*
For example, A1 and A4 are formatted red text, while A2, A3, and A5 are
formatted blue text. Â*I need it to tell me that there are 2 cells with red
and 3 cells with blue. Â*Thanks.


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
COUNTIF with various criteria NitaMax Excel Discussion (Misc queries) 6 October 4th 07 10:23 AM
countif but have two criteria Ani63 New Users to Excel 14 September 18th 06 09:28 PM
Countif using format criteria not number criteria? Rumbla76 Excel Worksheet Functions 1 April 20th 05 05:38 AM
Countif using format criteria....not number criteria? Troy Excel Worksheet Functions 1 April 20th 05 04:50 AM
countif criteria johnT Excel Worksheet Functions 5 March 28th 05 02:55 AM


All times are GMT +1. The time now is 02:16 PM.

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

About Us

"It's about Microsoft Excel"