 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 are bold type (1+4+5).

3 Replies

Re: IF criteria - cell characteristics

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.

Re: IF criteria - cell characteristics

Thank you very much, I think this will help me!

Have a nice day!

Re: IF criteria - cell characteristics

Here is another example without VBA

Sum of all bold cell values

Go to: Formulas -> "Define Name"

Set a custom name:

Insert -> Name -> Define -> Name in the table: 'Bold' ->

Refers to:

English:

= ASSIGN.CELL(20,Sheet1!\$A1)*1

German:

=ZELLE.ZUORDNEN(20;Tabelle1!\$A1)*1

(In the inserted example file you will find the correct settings for the table under the name manager.)

Now you can use the following column in any auxiliary column (here column B)

Enter formula:

= Bold

And get a 1 if the cell in the same row in column A is bold

is formatted.

Now you can use SUMMIF () to calculate the sum:

= SUMIF(B:B,1,A:A)

I would be happy to know if I could help.

Nikolino

I know I don't know anything (Socrates)

* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.