View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Obtaining Sum of Data in Bold Font

Try the below UDF

Suppose the range to be totalled is A1:A10; use the formula

=AddIfBold(C7:C16)

Function AddIfBold(varRange As Range) As Double
For Each cell In varRange
If cell.Font.Bold Then AddIfBold = AddIfBold + cell.Value
Next
End Function

If you are new to VBA; set the Security level to low/medium in
(Tools|Macro|Security). From workbook launch VBE using short-key Alt+F11.
From menu 'Insert' a module and paste the below code. Save. Get back to
Workbook.

If this post helps click Yes
---------------
Jacob Skaria


"Sum of Bold Numbers" wrote:

I have a set of numbers, some of which are in bold font and others are not.

I want to obtain the sum of the items in bold only, without distotorting the
original data.

Is there a way to do this?