Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
IF statement and color formatting for cell B1 for condition in A1 | Excel Worksheet Functions | |||
Another Date/Cell Color/Condition Formatting Question | Excel Discussion (Misc queries) | |||
counting cell color help | Excel Worksheet Functions | |||
I want to fill the cell color based upon the other cell condition | Excel Discussion (Misc queries) | |||
Counting Values on a condition | Excel Worksheet Functions |