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
 

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
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
11,266
Office Version
2013
Platform
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.
 

Forum statistics

Threads
1,081,695
Messages
5,360,679
Members
400,592
Latest member
katekoz

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top