Forum Discussion
davidbutov
Sep 29, 2021Copper Contributor
IF criteria - cell characteristics
Hello, is there a possibility in Excel to "sumif" or "countif" and the criteria is e.g. bold letters. 1 2 4 5 3 2 5 6 So, in this case it should only sum numbers which...
HansVogelaar
Sep 30, 2021MVP
No, you'd need VBA for that. Here is a user-defined function that you can copy into a module in the Visual Basic Editor:
Function SumBold(rng As Range) As Double
Dim cel As Range
Application.Volatile
For Each cel In rng
If cel.Font.Bold Then
SumBold = Application.Sum(SumBold, cel.Value)
End If
Next cel
End Function
You can then use it in a formula such as
=SumBold(A1:A10)
You'll have to save the workbook as a macro-enabled workbook and allow macros when you open it.
Warning: the formula result will not be updated automatically when you toggle the Bold property of a cell. It will be updated the next time Excel recalculates any formula. You can press F9 to update it immediately.
- davidbutovSep 30, 2021Copper Contributor