Count row of cells by colour not using filter

fudge1979

New Member
Joined
Jul 23, 2008
Messages
7
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.

Thanks in advance

Fudge1979
 

Excel Facts

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

fudge1979

New Member
Joined
Jul 23, 2008
Messages
7
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
 

fudge1979

New Member
Joined
Jul 23, 2008
Messages
7

ADVERTISEMENT

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
 

sadboy309

Board Regular
Joined
Oct 15, 2014
Messages
88
Do you can send this file for Drive.Google.com or sharefile link, you want know about that file?!
 

JLGWhiz

Well-known Member
Joined
Feb 7, 2012
Messages
12,979
Office Version
  1. 2013
Platform
  1. Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Top