Having trouble with formula to count cells based on font color

ec99ss

New Member
Joined
Oct 20, 2016
Messages
4
Hi all
I'm working on a data excel sheet and looking to count the cells in a column that have a certain font color. I wrote a VB function to do this. In the blank cell I wrote the formula to call up the function and count the cells in red (=CountColour(F4:F25,F16) Everything seems to work except it counts all the cells with a number.

Here is where I've narrowed the problem. In column F4:F25 I have another formula that converts certain cells to a red font (based on data elsewhere). What I'm seeing is that my CountColour formula does'nt see that 'red' font and thinks it's black. It's counting all the cells with a number in it.

Any ideas on how I can fix my formula(s)?

Thanks much!
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
You may have reinvented the wheel a bit :/

Chip Pearson has an excellent write-up on counting by color here: http://www.cpearson.com/excel/colors.htm

That write-up would have likely created the same end result you're getting now. BUT, he also provides a link to his other write-up on counting by *conditionally formatted color* here: http://www.cpearson.com/excel/CFColors.htm

As you'd imagine, it's more complicated, but it's still doable.
 
Upvote 0
You may have reinvented the wheel a bit :/

Chip Pearson has an excellent write-up on counting by color here: http://www.cpearson.com/excel/colors.htm

That write-up would have likely created the same end result you're getting now. BUT, he also provides a link to his other write-up on counting by *conditionally formatted color* here: http://www.cpearson.com/excel/CFColors.htm

As you'd imagine, it's more complicated, but it's still doable.

Ahh thank you! Wow this is certainly more complicated. The tinkerer in me wants to play with it to see how to make it work. The "I'm tired and want to get done" in me just wants to say forget it! Haha.

Thanks for pointing me in this direction.
 
Upvote 0

Forum statistics

Threads
1,216,074
Messages
6,128,649
Members
449,462
Latest member
Chislobog

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
Back
Top