Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 989
Default counting cell by color and condition

I'm trying count the number of cells in a column that have a particualr color
(36 for example) which also have the text "gp" in another column. I've seen
links at ozid, xldynamic and cpearson, but can't seem to get them to
reference to a text condition in addition to color. Any help
--
Mark
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default counting cell by color and condition

Can you show us the code you're now using - or think you'd like to use - that
is at least picking up on the colors? That will help determine what
additions you need to make to look in the other column for the text part of
the problem.

I suspect that if you have some code that is doing something like this:
For Each someCell In Selection
(could be lots of ways to deal with the For Each, but all are probably going
to be referencing a single-cell at a time within the For loop)
If someCell.Interior.ColorIndex = X ' where X is a color code value

End If
Next

In that If statement, once you've got a color match, you may be able to add
another If statement to test for the "gp" elsewhere. Remember that VB is
case sensitive, so this type of thing would help with that:
If Ucase(Trim(someCell.Offset(0, nCol))) = "GP" Then
'both conditions match
' increment your counter
End If

Where nCol is the number of columns away from the column your test-for-color
cell is in. Example: you're testing color in column F and you want to see if
cell in column G on same row has "GP in it, then it would be .Offset(0,1)
but if you wanted to test if C has "GP" in it, then it would be .Offset(0,-3)

Hope that helps some.
"Mark" wrote:

I'm trying count the number of cells in a column that have a particualr color
(36 for example) which also have the text "gp" in another column. I've seen
links at ozid, xldynamic and cpearson, but can't seem to get them to
reference to a text condition in addition to color. Any help
--
Mark

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
IF statement and color formatting for cell B1 for condition in A1 Rossta Excel Worksheet Functions 1 July 27th 06 12:37 AM
Another Date/Cell Color/Condition Formatting Question Millerk Excel Discussion (Misc queries) 1 March 1st 06 05:20 PM
counting cell color help darkbearpooh1 Excel Worksheet Functions 4 January 25th 06 02:59 AM
I want to fill the cell color based upon the other cell condition sri Excel Discussion (Misc queries) 4 January 12th 06 01:47 PM
Counting Values on a condition madeforidiots Excel Worksheet Functions 1 July 27th 05 12:40 AM


All times are GMT +1. The time now is 12:23 AM.

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"