Count cells according to format

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

if i have a row of data, some in a normal font and others in BOLD, is it
possible to count how many cells use the BOLD format in the range?
 
By formula or by VBA?

I'm sure, that it works with VBA, but I don't know if it is possible
with a Formula.

Carlo
 
You could employ a user defined function.

Function CountBold(rg As Range) As Long
''originally posted by Ron Rosenfeld
Dim c As Range
For Each c In rg
CountBold = CountBold - c.Font.Bold
Next c
End Function

=CountBold(A1:M1)

If you have Excel 2003(don't know about 2007)

You could try this alternate method which doesn't use VBA or any add-ins.

In 2003 you can specify the Format color to look for under
Edit>Find>Options>Format>Format.

Select the Bold Font Type from the Font dialog and Find All.

In the found dialog box the first cell will be highlighted. Then SHIFT + End +
DownArrow to select all..

The selected cells can then be counted by right-click on Status Bar and "Count".


Gord Dibben MS Excel MVP
 

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

Back
Top