SUM of column based on format criteria

S

SRN

I need to sum a column which has a series of dollar amounts, some the same,
but only include numbers once they have been made bold. eg

23.50
67.80 (Bold format)
99.45
88.23
23.50(Bold format)
22.45
88.23
19.00

In the above example the sum would be only of numbers with bold format. What
would e the formula to do that

Thanks

SRN
 
M

Mike H

Hi,

there is no inbuilt finction for SumBold you have to write one so try this

Alt+F11 to open VB editor. Right click 'This Workbook' and insert module and
paste the code below in

call with =SumBold(A1:A20)

Note that simply bolding a cell won't cause the worksheet to recalculate so
refresh the formula with F9 when bolding a cell

Function SumBold(rng As Range) As Variant
Application.Volatile
For Each c In rng
If IsNumeric(c) And c.Font.Bold Then
SumBold = SumBold + c.Value
End If
Next
End Function

Mike
 

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