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

Excelで数値のすべての桁を合計するにはどうすればよいですか?

値を含むセルがあり、ここで、セルのすべての数字を足し合わせたい場合。 たとえば、セルに値12345がある場合、次の計算を実行します:1 + 2 + 3 + 4 + 5、値15を取得します。数値のすべての桁を合計するための良い方法はありますか? Excelで?


数式を使用してセル内の数値のすべての桁を合計する

数字をXNUMXつずつ手動で追加しなくても、次の数式を使用すると、セルの合計をすばやく取得できます。

1.次の数式のいずれかを空白のセルに入力またはコピーして、結果を出力してください。

=SUMPRODUCT(1*MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1))
=SUM(INDEX(1*(MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)),,))

2。 次に、 入力します キーを押して結果を返し、セルC2を選択してから、この数式を適用する範囲まで塗りつぶしハンドルをドラッグすると、各セル番号の桁の合計が表示されます。スクリーンショットを参照してください。

ノート:

  • 上記の式では、 A2 セルには、その桁を合計する数値が含まれています。
  • 数値に負の符号または小数点がある場合、数式は#VALUE!を返します。 エラー。

ユーザー定義関数を使用して、セル内の数値のすべての桁を合計します

セル番号のすべての桁を合計するには、次のVBAコードも役立ちます。

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

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

VBAコード:セル番号のすべての桁を合計します

 Function SumDigits(Number As String) As Integer
'Updateby Extendoffice
Dim x As Integer, C As String
For x = 1 To Len(Number)
C = Mid(Number, x, 1)
If IsNumeric(C) Then SumDigits = SumDigits + C
Next
End Function

3。 次に、このコードを保存して閉じ、ワークシートに戻って、この数式を入力します = SumDigits(A2) 空白のセルに入力し、塗りつぶしハンドルをこの数式を含めるセルまでドラッグすると、次の結果が得られます。


簡単な機能でセル内の数値のすべての桁を合計する

ここでは、便利なツールについても話すことができます- Kutools for Excelそのと セル内の数値の合計 機能を使用すると、数値内のすべての桁をすばやく合計できます。

注:これを適用する セル内の数値の合計、まず、ダウンロードする必要があります Kutools for Excel、次に機能をすばやく簡単に適用します。

インストールした後 Kutools for Excel、次のようにしてください。

1。 結果を出力する空白のセルをクリックします。

2。 次に、をクリックします クツール > フォーミュラヘルパー > フォーミュラヘルパー、スクリーンショットを参照してください:

3。 の中に 数式ヘルパー ダイアログボックスで、次の操作を実行します。

  • 選択 数学 オプションから    ドロップダウンリスト;
  • それから、 セル内の数値の合計 fromulaを選択してください リストボックス;
  • 右にあります 引数入力 セクションで、数字を合計するセルを選択します。

4。 次に、をクリックします Ok ボタンをクリックし、セル内の数字を合計するセルに塗りつぶしハンドルをドラッグします。 そして、各セルのすべての数字が一緒に追加されました。スクリーンショットを参照してください。

今すぐExcel用のKutoolsをダウンロードして無料トライアル!


より相対的な記事:

  • Excelの範囲の対角線の合計
  • 算術計算を行うときは、テーブル内の数値を対角線で合計する必要がある場合があります。 実際、Excelで対角線の数値を合計することもできます。これにより、数値をXNUMXつずつ合計する必要がなくなります。 この質問について詳しく知りたい場合は、次の記事をお読みください。
  • 重複する行を組み合わせて値を合計する
  • Excelでは、次のスクリーンショットに示すように、重複するエントリを含むデータの範囲があり、重複するデータを結合して対応する値を別の列に合計する場合、常にこの問題が発生する可能性があります。 この問題をどのように解決できますか?
  • 列と行の基準に基づく合計
  • 行ヘッダーと列ヘッダーを含むデータの範囲があります。次に、列ヘッダーと行ヘッダーの両方の条件を満たすセルの合計を取得します。 たとえば、次のスクリーンショットに示すように、列の基準がTomで、行の基準がFebであるセルを合計します。 この記事では、それを解決するためのいくつかの便利な式について説明します。
  • Excelで1からNまでの数値の合計
  • ほとんどのExcelユーザーの場合、以下のスクリーンショットに示すように、テキスト文字列の先頭から最初のn文字を削除するか、テキスト文字列の末尾から最後のx文字を削除する必要がある場合があります。 この記事では、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 (26)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Bonjour,
Je cherchais justement cette solution c.à.d. comment faire la somme des chiffres d'un nombre (de 4 chiffres) sur excel et je suis tombé sur ce site. Je suis en profonde admiration devant l'intelligence de certains qui ont trouvé des formules de ouf. Malheureusement, je ne suis pas à ce niveau pour les mettre en pratique. Je me suis dit (car j'aime me parler, comme ça, j'ai toujours raison LOL) que pourquoi chercher compliqué quand on peut faire plus simple et j'ai trouvé une solution qui n'est pas élégante (OK je ne suis pas Einstein) et qui marche. Que veut on de plus ! Je vous la donne ici.
Je prends un exemple avec un nombre à 4 chiffres mais vous pouvez ajouter autant de chiffres que vous voulez. Disons que ce nombre est dans la cellule A2 pour l'exemple :
=STXT($A$2;1;1)+STXT($A$2;2;1)+STXT($A$2;3;1)+STXT($A$2;4;1)
J'ai mis des $ pour pouvoir copier plus facilement et ensuite je n'ai qu'à changer le rang du chiffre, dans mon cas 1, 2, 3, 4 et vous pouvez allez aussi loin que vous voulez
En anglais, vous remplacez STXT par MID et en allemand par TEIL
Si vous voulez la somme du résultat (dans la cellule A3 par ex.), vous faites la même chose en remplaçant A2 par A3.
Voila
Julien
This comment was minimized by the moderator on the site
Já procurei mais não acho por nada eu queira fazer uma planilha que o resultado da soma final reduz o número a 1 dígito. Por exemplo o resultado deu 7+6=13 e ele virasse 1+3= 4
This comment was minimized by the moderator on the site
I want to two digits like: 11.03 and 1.11, so i want to answer is coming 13.02.kindly provide a formula.
This comment was minimized by the moderator on the site
I play KillerSudoku: If I have n number of sums (not the total or answer) but I have say 2 or 3 or more empty cells with number possibilities who's sum totals 15; say, the total is 15 and I have 4 empty squares that all live in the same cage (meaning non-repeating), how do I show all possible sums: ie, 2+3+6+4, or 3+5+1+6, or 3+4+6+1 and so on. Also, I need to sometimes show all possible sums with repeating. Can this be done in Excel
This comment was minimized by the moderator on the site
Hello, Kevin,Maybe the following article can do you a favor:https://www.extendoffice.com/documents/excel/3557-excel-find-all-combinations-that-equal-given-sum.html
Please try, thank you!
This comment was minimized by the moderator on the site
Hello Experts. I have a question. For instance i have 18487.73486. I want a cell to sum 18487 and another cell that would sum the 73486. How do I go about doing it? Will appreciate any response. tia
This comment was minimized by the moderator on the site
Your Solution or the Formula is excellent. Thanks for the quick fix .
This comment was minimized by the moderator on the site
I typed 3 zero in 2nd column and put sum formula i.e. 50 in 1st column and three zero in 2nd column but excel is not working because the zero are going to remove automatically. Could you please help me.
This comment was minimized by the moderator on the site
Hello, Murtuza,
Sorry, I don't get your point, please give more detailed information about your problem, or you can insert a screenshot here.
Thank you!
This comment was minimized by the moderator on the site
How to count number in a cell in excel i.e. for example : 1+1+2+3+4+5+6+7 = 8
This comment was minimized by the moderator on the site
Hi,
Maybe the below article can solve your problem, please check it:
https://www.extendoffice.com/documents/excel/1504-excel-count-letters-in-cell.html
Hope it can help you!
This comment was minimized by the moderator on the site
Thank you so much
This comment was minimized by the moderator on the site
I am trying to find the avg of multipule numbers in a cell, lets say 22,11,18,14,3,6 are all in the same cell is there a way for another cell to display 12.3?
This comment was minimized by the moderator on the site
Hello, john,
To calculate the average of multiple numbers within a cell, please apply the below formula:
=IF(A1="","",ROUND(SUMPRODUCT(--(0&TRIM(MID(SUBSTITUTE(A1,",",REPT(" ",99)),ROW($1:$99)*99-98,99))))/(LEN(A1)-LEN(SUBSTITUTE(A1,",",))+1),2))
Note: the last number 2 in the formula indicates that retain two decimal places after rounding. You can change it to your need.

Please try it, hope it can help you!
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