# Count row of cells by colour not using filter

#### fudge1979

##### New Member
Hi There

I am a first time poster here. I am building a NRL Footy tipping log to keep track of every bodies tips during the year.

I stuck on something. I am trying to count a row of cells for the person's tips during the round. I have conditionally formatted the cells to show the difference between the winning and losing teams. but I am struggling to come up with a formula to count the row of cells by colour

Say for example B2:I2 there is 5 Cells that are coloured 'Green' for the winning team. How to do I count the number of 'Green' cells from B2:I2 and have the total in cell J2? and then copy the formula down for the rest of the tipsters? I tried looking on Google but I wasn't able to find out what I needed.

Sorry I am not sure how to paste a screenshot of the SS?

I am working on other things in this SS so I am sure that I will have more questions to ask.

Fudge1979

### Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the \$ sign).

#### JLGWhiz

##### Well-known Member
Chip Pearson explains in the link below why you are having a hard time counting the colors set by conditional formatting. You need to regroup and use a different method.
http://www.cpearson.com/Excel/CFColors.htm

Last edited:

#### fudge1979

##### New Member
Hi JLGWhiz

Thanks for the reply and the info. I am still very new at VBA and have very little knowledge of it.

I chose the '
CountOfCF' function as that seemed like the best one to use. I copied and pasted the 'ActiveCondition' in to the macro and I changed the formula to =CountOfCF(B2:I2,-1) but I am still getting #NAME ?. I also tried =CountOfCF(B2:I2,1) & =CountOfCF(B2:I2,2) & =CountOfCF(B2:I2,3) but still the same result. not sure what I am doing wrong?

Thanks

Fudge1979

##### Board Regular
Count row of cells by colour with =Get.CELL(38,cellcolor)

As picture:

#### fudge1979

##### New Member

Thanks sadboy309, I tried doing it this way and at the COUNTIF formula, I keep getting zero as the result. I checked the formula in FORMULA>NAME MANAGER as I know it can change but it didn't. I know the cell colour number is 10.

I have also tried doing the third way on https://trumpexcel.com/count-colored-cells-in-excel/ using the code VBA and I got the same result which was zero.

I am not sure what I am doing wrong??

Thanks

Fudge1979

##### Board Regular
Do you can send this file for Drive.Google.com or sharefile link, you want know about that file?!

#### JLGWhiz

##### Well-known Member
Thanks sadboy309, I tried doing it this way and at the COUNTIF formula, I keep getting zero as the result. I checked the formula in FORMULA>NAME MANAGER as I know it can change but it didn't. I know the cell colour number is 10.

I have also tried doing the third way on https://trumpexcel.com/count-colored-cells-in-excel/ using the code VBA and I got the same result which was zero.

I am not sure what I am doing wrong??

Thanks

Fudge1979

If you read Chip's article on CF colored cells, you would see that the color number is NOT detected the same as an Interior Fill color. In fact the color number is not detected at all if applied by CF. You have to search for the criteria used to set the CF colors to count the number of cells. It is a cumbersome process and I would recommend that you use a different method of identifying the cells you want to count. I cannot offer any code because there is nothing in this thread that allows us to know why a cell is colored nor what color is used for what reason. Without that information, you are beating a dead horse.

Replies
20
Views
336
Replies
2
Views
261
Replies
15
Views
1K
Replies
4
Views
719
Replies
1
Views
340

1,129,374
Messages
5,635,888
Members
416,886
Latest member
coreyalaurence37

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back