Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Obtaining Sum of Data in Bold Font

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?
  #2   Report Post  
Posted to microsoft.public.excel.misc
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?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Obtaining Sum of Data in Bold Font

Hi,

Try this UDF. Alt+F11 to open VB editor. Right click 'ThisWorkbook" and
insert module and paste the code below in.

Call with =SumBold(A26:G26)


Public Function SumBold(Rng As Range) As Long
For Each c In Rng
If IsNumeric(c.Value) And c.Font.Bold = True Then
SumBold = SumBold + c.Value
End If
Next c
End Function

Mike
"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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bold font if statement drb Excel Worksheet Functions 3 March 9th 08 09:01 PM
Bold Font question Jenny B. Excel Discussion (Misc queries) 3 August 17th 07 04:02 PM
Bold Font question bj Excel Discussion (Misc queries) 1 August 17th 07 01:48 AM
Bold font for Location Totals pm Excel Discussion (Misc queries) 5 April 10th 07 05:20 PM
How to show only bold font ? hamz Excel Worksheet Functions 2 March 8th 06 04:51 AM


All times are GMT +1. The time now is 06:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"