メインコンテンツへスキップ

Excelのセル範囲の太字の数値を合計/カウントするにはどうすればよいですか?

ワークシートにいくつかの太字の数値を含むデータ範囲があり、太字のセルのみを合計またはカウントしたい場合は、もちろん手動でXNUMXつずつ合計することもできますが、時間がかかります。 簡単かつ迅速な方法で、Excelの太字のセルのみを合計またはカウントするにはどうすればよいですか?

ユーザー定義関数(VBAおよび数式)を使用して、範囲内の太字の数値をカウントします
ユーザー定義関数(VBAおよび数式)を使用して、範囲内の太字の数値を合計します
Kutools for Excelを使用して、数回クリックして範囲内の太字のセルをカウントおよび合計します


ユーザー定義関数を使用して、範囲内の太字の数値をカウントします

以下 ユーザー定義関数 太字のセルの数をすばやく取得するのに役立ちます。 このようにしてください:

1。 を押し続けます Alt + F11 キー、そしてそれは開きます Microsoft Visual Basic forApplicationsウィンドウ.

2に設定します。 OK をクリックします。 インセット > モジュール、次のコードをに貼り付けます モジュールウィンドウ.

VBAコード:セル範囲内の太字の数字を数える

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. 次に、このコードを保存して、この式を入力します = CountBold(A1:C9) 空白のセルに、スクリーンショットを参照してください。

doc-count-bold-cells1

4。 次に、 入力します キーを押すと、A1:C9の範囲の太字のセルがカウントされます。

doc-count-bold-cells2

注:A1:C9 数式では、関数を使用して太字のセルをカウントする範囲を示しています。必要に応じて変更できます。


ユーザー定義関数を使用して、範囲内の太字の数値を合計します

また、データ範囲内の太字の数値のみを合計したい場合は、それを解決するためのユーザー定義関数を作成することもできます。

1. 押したまま Alt + F11 キー、そしてそれは開きます Microsoft Visual Basic forApplicationsウィンドウ.

2に設定します。 OK をクリックします。 インセット > モジュール、次のコードをに貼り付けます モジュールウィンドウ.

VBAコード:セルの範囲内の太字の数字の合計

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。 次に、このコードを保存して、この式を入力します = sumbold(A1:C9) 空白のセルに、スクリーンショットを参照してください。

doc-count-bold-cells3

4. そして、 入力します キー、A1:C9の範囲のすべての太字の数字が合計されています。 スクリーンショットを参照してください:

doc-count-bold-cells4

注:A1:C9 数式では、関数を使用して太字のセルを合計する範囲を示しています。必要に応じて変更できます。


Kutools for Excelを使用して、数回クリックして範囲内の太字のセルをカウントおよび合計します

Y複雑なVBAコードを処理したり、数式を覚えたりすることなく、数回クリックするだけで、範囲内のすべての太字のセルを簡単にカウントまたは合計できます。

申請する前に Kutools for Excelについては 最初にダウンロードしてインストールします.

1.太字のセルをカウントするには、結果を見つけるために空白のセルを選択してから、をクリックしてください クツール > Kutools関数 > 統計と数学 > カウントビーフォントボールド.

太字のセルを合計するには、 クツール > Kutools関数 > 統計と数学 > サンビーフォントボールド。 スクリーンショットを参照してください:

2.Fで油注ぎの議論 ダイアログボックスで、[参照]ボックスでカウントまたは合計する必要のある太字のセルで範囲を指定し、[参照]ボックスをクリックします。 OK

これで、指定した範囲内のすべての太字セルのカウントまたは合計が、選択したセルにすぐに入力されます。 スクリーンショットを参照してください:

  このユーティリティの無料トライアル(30日)が必要な場合は、 クリックしてダウンロードしてください、次に、上記の手順に従って操作を適用します。


Kutools forExcelで数式セル参照を一定に保つ


関連記事:

Excelですべての太字のセルまたはテキストを識別して選択するにはどうすればよいですか?

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
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