Skip to main content

How to sum / count bold numbers in a range of cells in Excel?

When you have a data range which contains some bold numbers in a worksheet, and now you want to sum or count only the bold cells, of course you can add them up one by one manually, but it will be time-consuming. How could you sum or count only the bold cells in Excel with an easy and quick way?

Count bold numbers in a range with User Defined Function (VBA and formula)
Sum bold numbers in a range with User Defined Function (VBA and formula)
Several click to count and sum bold cells in a range with Kutools for Excel


Count bold numbers in a range with User Defined Function

The following User Defined Function can help you quickly get the number of bold cells. Please do as this:

1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code:Count bold numbers in a range of cells

Function CountBold(WorkRng As Range)
'Update 20220516
Dim Rng As Range
Dim xCount As Double
For Each Rng In WorkRng
    If Rng.Font.Bold Then
        xCount = xCount + 1
    End If
Next
CountBold = xCount
End Function

3. Then save this code, and type this formula =CountBold(A1:C9) into a blank cell, see screenshot:

doc-count-bold-cells1

4. Then press Enter key, and you will count the bold cells in the range A1:C9.

doc-count-bold-cells2

Note:A1:C9 in the formula indicates the range you want to use the function to count the bold cells, you can change it as your need.


Sum bold numbers in a range with User Defined Function

And if you want to sum only the bold numbers in a data range, I can also create a user defined function for you to solve it.

1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste the following code in the Module Window.

VBA code:Sum bold numbers in a range of cells

Function SumBold(WorkRng As Range)
'Update 20220516
Dim Rng As Range
Dim xSum As Double
For Each Rng In WorkRng
    If Rng.Font.Bold Then
        xSum = xSum + Rng.Value
    End If
Next
SumBold = xSum
End Function

3. Then save this code, and type this formula =sumbold(A1:C9) into a blank cell, see screenshot:

doc-count-bold-cells3

4. And then press Enter key, all the bold numbers in the range A1:C9 have been added up. See screenshot:

doc-count-bold-cells4

Note:A1:C9 in the formula indicates the range you want to use the function to sum the bold cells, you can change it as your need.


Several click to count and sum bold cells in a range with Kutools for Excel

You can easily count or sum all bold cells in a range with several clicks without handling complicated VBA code and remembering formulas.

Before applying Kutools for Excel, please download and install it firstly.

1. For counting bold cells, please select a blank cell for locating the result, and then click Kutools > Kutools Functions > Statistical & Math > COUNTBYFONTBOLD.

And for summing bold cells, click Kutools > Kutools Functions > Statistical & Math > SUMBYFONTBOLD. See screenshot:

2. In the Function Arguments dialog box, specify the range with bold cells you need to count or sum in the Reference box, and then click the OK button.

Now the counting or summing of all bold cells in specified range are populated in selected cell immediately. See screenshot:

  If you want to have a free trial (30-day) of this utility, please click to download it, and then go to apply the operation according above steps.


Keep formula cell reference constant with Kutools for Excel


Related articles:

How to identify and select all bold cells or text in Excel?

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (22)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hello Anthony,
I was struggling with the same problem. For me, the solution ended up being very simple. I noticed I had 4 Modules listed. I removed all of them and then started over with the above instructions. Now it works perfectly.
This comment was minimized by the moderator on the site
I use the function and keep getting the #NAME? error. I am using Excel 365 and Windows11.
This comment was minimized by the moderator on the site
Hello, Anthony

Have you copied and pasted the code into the Module of Microsoft Visual Basic for Applications window in your worksheet? Afetr pasting the code, then, you should enter the formula as you need.

Or you can upload your file here, we can check where the problem is.

Thank you!
This comment was minimized by the moderator on the site
Ma se metto in grassetto nuove celle, la somma non si aggiorna !!!
This comment was minimized by the moderator on the site
Hello Carlo,

Gald to help. After you bold new cells, the sum won't update automatically. But when you double-click the formula cell, then press Enter, the sum will update. Please have a try.

Sincerely,
Mandy
This comment was minimized by the moderator on the site
Hi Mandy,
thanks for your reply,
Yes I know that after double click the sum will uograde.
Is there any way to upgrade automatically the sum ?

Regards
Carlo
This comment was minimized by the moderator on the site
Hello Carlo,

Sorry that I don't have the solution for automatically upgrading the sum. The easiest way I can think of is to press Ctrl + Alt + F9 to recalculate all worksheets in all open workbooks. Have a nice day.

Sincerely,
Mandy
This comment was minimized by the moderator on the site
А если в ячейках числа и текст? надо просуммировать только ячейки с числами жирным шрифтом.
This comment was minimized by the moderator on the site
RE: CountBold formula This formula does not appear to be dynamic. While it works at first pass, if i change the bolded cells the counters do not update unless i re-enter the formula again. Any tips?
This comment was minimized by the moderator on the site
Yea this is the same for me, otherwise it works great. But if this could be solved so it refreshes the count after each cell deselect like other basic counts it would be perfect!
This comment was minimized by the moderator on the site
Dear guys,
The formula won't update if you just change the format of the number cells.
It updates only when you change the cell content.
This comment was minimized by the moderator on the site
I'm using excel for mac 2011. How can I run the code on my system? thanks!
This comment was minimized by the moderator on the site
I copied and pasted code into excel but get #NAME? error. I made sure to enable macros and using excel 2010 version (don't know if that changes anything). Can anyone please help?!
This comment was minimized by the moderator on the site
[quote]I copied and pasted code into excel but get #NAME? error. I made sure to enable macros and using excel 2010 version (don't know if that changes anything). Can anyone please help?!By Maey[/quote] You have to follow the instruction. It says: "Click Insert > Module, and paste the following code in the Module Window", and you have to do exactly so. Make sure you paste the code in the Module Window, not in the Sheet code Window.
This comment was minimized by the moderator on the site
Thank you.. it's working...
This comment was minimized by the moderator on the site
This works a treat. I only have one issue...it doesn't seem to be adding anything after a decimal point. Any help would be greatly appreciated.
This comment was minimized by the moderator on the site
This works perfectly except it doesn't seem to add my decimal places, only adds the whole dollar. If you have a fix for this I would be very grateful.
This comment was minimized by the moderator on the site
Hi Katie, Use the below code, as the sum shows decimal places. Function SumBold(rng As Range) Dim rCell As Range Application.Volatile SumBold = 0 For Each rCell In rng If rCell.Font.Bold Then _ SumBold = SumBold + rCell Next End Function
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations