Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COUNTIF function

Status
Not open for further replies.

wmbb

Technical User
Jul 17, 2005
320
NL
Is it possible to count the cells containing text in red (fontcolor = red) using COUNTIF or another formula?
 
No

You need to write your own VBA function for that

Have a search of the VBA forum: Forum707 wherre this has been discussed several times previously

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
You can't ( not easily anyway ). Have a look at this FAQ: faq68-6657 . It contains code that you could modify to be of use.

Cheers, Glenn.

Beauty is in the eye of the beerholder.
 
Thnx for your help.
I think I can do something with the function below.

Function FntColor() As String
If .Font.Color = RGB(0, 0, 0) Then
FntColor = "black"
ElseIf .Font.Color = RGB(255, 0, 0) Then
FntColor = "red"
Else: FntColor() = "normal"
End If
End If
End Function


One question left....

What do I have to put in front of .Font.Color to get this working in
=COUNTIF(B5:B10,FntColor = "black")
 



Notice the PERIOD preceeding the Font object in the code you posted. THAT needs to be preceeded by a range object. Please post in forum707 to get help with this.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Seriously - just search the VBA forum for "Sum By Colour" - there are functions already written to do exactly what you want

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top