Count cells according to format

S

scheduler

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?
 
C

carlo

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
 
G

Gord Dibben

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
 
Top