Count based on color

J

John Kirschner

I need to use a formula that does a count based on font color. Is it
possible? And do you have an example I could see?
 
O

Ola

Try this:
=FontColor(A1)

But first:
Press Alt+F11. Insert Module. Copy and Paste the below:
Public Function FontColor(MyCell As Range) As Variant
Application.Volatile True
FontColor = MyCell.Font.ColorIndex
End Function

Ola Sandstrom


Note:
Excel normally don't recalcualte if a cell change font color. That is why we
include Application.Volatile True
But this can make Excel slow.
To speed up, include a ' in front of Application.Volatile True. This will
deactivate Application.Volatile True.
Then use =IF(NOW()>0,GetColor(A1),"").
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top