how to use SUMIF to add the values of a column that are bolded

I have a column of numbers (say, A1 to A500).  Some of the numbers are in bold.  How can I calculate the sum of the numbers in bold?
pwflexnerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SiddharthRoutCommented:
I am not sure if you can do this via a Formula but you can definitely achieve it via VBA. Would a user defined function do?

Sid
0
pwflexnerAuthor Commented:
Actually, it's probably not worth the trouble.  I can do the work by hand, but thought there might be a simple way to achieve it through SUMIF.  Thanks anyway...
0
SiddharthRoutCommented:
Ok. I just wrote the code in case you want it, let me know I will post it :)

Sid
0
SiddharthRoutCommented:
Since I already wrote it, here it is :)

Paste this in a module

'~~>USAGE =SumBold(A1:A10)
Public Function SumBold(Rng As Range) As Variant
    Dim aCell As Range, nSum As Double
    Application.Volatile
    
    On Error GoTo Whoa
    
    For Each aCell In Rng.Cells
        With aCell
            If .Font.Bold Then nSum = nSum + .Value
        End With
    Next
    SumBold = nSum
LetsContinue:
     On Error GoTo 0
     Exit Function
Whoa:
     MsgBox Err.Description
     Resume LetsContinue
End Function

Open in new window


So if Cells A1 to A10 have some bold cells then type this in Cell B1

=SumBold(A1:A10)

and you will get the sum :)

Sid
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pwflexnerAuthor Commented:
Thanks!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.