ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   SUM of column based on format criteria (https://www.excelbanter.com/excel-discussion-misc-queries/212762-sum-column-based-format-criteria.html)

SRN

SUM of column based on format criteria
 
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


Mike H

SUM of column based on format criteria
 
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

"SRN" wrote:

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



All times are GMT +1. The time now is 08:27 PM.

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