ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Functions in worksheets (https://www.excelbanter.com/excel-discussion-misc-queries/129482-functions-worksheets.html)

scampbell

Functions in worksheets
 
Does anyone know if it is possible to add numbers if they have a certain
format. For example, I have a column of numbers with some in bold format. I
only want to add the ones that are bold. Can that be done? If so, how?

Gary''s Student

Functions in worksheets
 
Enter and use this UDF:

Function countbold(r As Range) As Double
countbold = 0
For Each rr In r
If rr.Font.FontStyle = "Bold" Then
countbold = countbold + rr.Value
End If
Next
End Function


just be careful of volitility issues if you change fonts afterwards.
--
Gary's Student
gsnu200704


"scampbell" wrote:

Does anyone know if it is possible to add numbers if they have a certain
format. For example, I have a column of numbers with some in bold format. I
only want to add the ones that are bold. Can that be done? If so, how?



All times are GMT +1. The time now is 02:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com