Just Curious: What is the condition for those numbers to be in bold?
The numbers are column headings...divisional groups.
I thought the bold numbers were in a column range, now it appears they are column headings (representing divisional groups), probably in a single row (row 1 perhaps)? Why you would want to total column headings escapes me.
Anyway here a UDF that can tell whether a cell value is bold.
Function ISBOLD(cell) As Boolean
'
' Returns TRUE if cell is bold
' Walkenbach
'
ISBOLD = cell.Range("A1").Font.Bold
End Function
Let assume that you have a series of numbers in A2:A10.
In B2 enter: =ISBOLD(A2)*A2 [ copy down this as far as needed ]
In B1 enter: =SUM(B2:B10)
If some VBA'er around this board can make this UDF return an array of boolean values, the following single formula would be possible:
=SUMPRODUCT((ISBOLD(A2:A10))*(A2:A10))
Aladin
Try this UDF
Function SumBold(SumRg As Range) As Double
Dim ocell As Range
Dim Tot As Double
Application.Volatile
For Each ocell In SumRg
If ocell.Font.Bold = True Then
Tot = Tot + ocell.Value
End If
Next
SumBold = Tot
End Function
Post if further help required
Ivan Returns TRUE if cell is bold Walkenbach
Darn it, I get more and more dragged into the VBA thing! Try this UDF Function SumBold(SumRg As Range) As Double
Thanks, Ivan. Filed. : If some VBA'er around this board can make this UDF return an array of boolean values, the following single formula would be possible:
I didn't yet see (admit: didn't try hard enough) a good UDF example returning an array of (boolean) values. Can I get one?
Aladin
You guys are awesome...thanks!