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

ExcelでXNUMX行おきまたはn番目の行/列をすばやく合計するにはどうすればよいですか?

ご存知のとおり、Sum関数を適用してセルのリストを追加できますが、何らかの目的でXNUMXつおきのセルを合計する必要がある場合があり、Excelにはn番目ごとのセルを合計できる標準関数がありません。 この状況で、ExcelでXNUMX行おきまたはn番目の行/列を合計するにはどうすればよいでしょうか。

数式を使用して、XNUMX行おきまたはn番目の行/列を合計します

ユーザー定義関数を使用して、XNUMX行おきまたはn番目の行/列を合計します

Kutools forExcelでXNUMX行おきまたはn番目の行/列を合計/平均/カウント


次の例では、XNUMXつおきのセルを合計する数式を適用する方法を示します。

1.配列数式を使用して、XNUMX行おきまたは列を合計します

空白のセルに、次の数式を入力してください。 =SUM(IF(MOD(ROW($B$1:$B$15),2)=0,$B$1:$B$15,0)), それから、 Ctrl + Shift + Enter キー、および列Bの他のすべてのセル値が合計されています。 スクリーンショットを参照してください:

doc-sum-other-every-cell1 2 doc-sum-other-every-cell2

注意:

1.上記の配列数式では、数値2を3、4、5…に変更できます。これは、3行ごと、4行ごと、5行ごとの合計を意味します…

2. XNUMX列おきに合計する場合は、次の式を入力できます。 =SUM(IF(MOD(COLUMN($A$1:$O$1),2)=0,$A$1:$O$1,0))、プレス Ctrl + Shift + Enter 結果を得るためのキー。 スクリーンショットを参照してください:

doc-sum-other-every-cell3

2.数式を使用して、XNUMX行おきまたは列を合計します

ワークシートのXNUMXつおきまたはn番目のセルを合計するのに役立つ別の数式を次に示します。

空のセルに、次の数式を入力してください。 =SUMPRODUCT((MOD(ROW($B$1:$B$15),3)=0)*($B$1:$B$15))。 そして、 入力します キー、およびすべての3番目のセルが追加されています。 スクリーンショットを参照してください:

doc-sum-other-every-cell4 2 doc-sum-other-every-cell5

注意:

1.上記の式では、数値3を4、5、6…に変更できます。これは、4行ごと、5行ごと、6行ごとの合計を意味します…

2. XNUMX列おきに合計する場合は、次の式を入力できます。 =SUMPRODUCT((MOD(COLUMN($A$1:$O$1),3)=0)*($A$1:$O$1)).

doc-sum-other-every-cell6


次のユーザー定義関数は、ExcelでXNUMXつおきまたはn番目のセルを追加するのにも役立ちます。

1。 を押し続けます Alt + F11 キー、そしてそれは開きます アプリケーション向け Microsoft Visual Basic 窓。

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

Function SumIntervalRows(WorkRng As Range, interval As Integer) As Double
'Updateby Extendoffice
Dim arr As Variant
Dim total As Double
total = 0
arr = WorkRng.Value
For i = interval To UBound(arr, 1) Step interval
    total = total + arr(i, 1)
Next
SumIntervalRows = total
End Function
Function SumIntervalCols(WorkRng As Range, interval As Integer) As Double
Dim arr As Variant
Dim total As Double
total = 0
arr = WorkRng.Value
For j = interval To UBound(arr, 2) Step interval
    total = total + arr(1, j)
Next
SumIntervalCols = total
End Function

3。 次に、このコードを保存し、必要に応じて次の数式を空白のセルに入力します。スクリーンショットを参照してください。

XNUMX行ごとに合計する場合: = SumIntervalRows(B1:B15,4)

doc-sum-other-every-cell7

XNUMX列ごとに合計する場合: = SumIntervalCols(A1:O1,4)

doc-sum-other-every-cell8

4。 次に、 入力します キー、あなたは計算を取得します。 スクリーンショットを参照してください:

XNUMX行ごとに合計:

doc-sum-other-every-cell9

XNUMX列ごとに合計:

doc-sum-other-every-cell10

Note:数値4を2、3、5などの他の数値に変更できます。これは、XNUMX行ごと、XNUMX行ごと、XNUMX行または列ごとの合計を意味します。


ほとんどの人にとって、数式とユーザー定義関数の両方がやや難しいかもしれません。ここでは、このタスクを解決するためのより簡単な方法を紹介します。

Kutools for Excelさん 間隔の行と列を選択します、最初に必要なXNUMXつおきまたはn番目のセルを選択し、最後にSum関数を使用してセルを合計して、選択したセルに定義済みの名前を付けることができます。

Kutools for Excel : 300以上の便利なExcelアドインがあり、30日以内に制限なしで無料で試すことができます. 

インストールした後 Kutools for Excel、次の手順で実行してください。

1。 XNUMXつおきまたはn番目のセルを合計する列を選択します。

2に設定します。 OK をクリックします。 クツール > 選択 > 間隔の行と列を選択します、スクリーンショットを参照してください:

3。 の中に 間隔の行と列を選択します ダイアログボックスで、必要に応じて操作を指定します。スクリーンショットを参照してください。

doc-sum-other-every-cell12

4に設定します。 OK をクリックします。 OK、およびXNUMX行おきに最初の行から選択されているため、ステータスバーの下部に平均、合計、カウントなどの計算結果が表示されます。 スクリーンショットを参照してください:

doc-sum-other-every-cell13

注意:

1.この機能を使用すると、2、3、4…の番号を設定できます。 の間隔 オプションを選択すると、手順2で範囲の最初の行から開始して、3、4、3行の間隔でセルを選択します。

2.上記の手順で、必要に応じてXNUMX列おきまたはn列目を合計することもできます。

この機能について詳しく知りたい場合は、をクリックしてください。 間隔の行と列を選択します.

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


Kutools for Excel:300以上の便利なExcelアドインがあり、30日以内に制限なしで無料で試すことができます。 今すぐダウンロードして無料トライアル!

関連記事:

Excelでフィルター処理されたセルまたは表示されているセルのみを合計するにはどうすればよいですか?

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 (20)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
the above given codes work but when the file is closed and reopen, it doesn't work. again the same codes needs to copy and paste. pls give permanent solution
This comment was minimized by the moderator on the site
Hello,
After pasting the code, when you close the workbook, you should save the workbook as Excel Macro-Enabled Workbook format to save the code.
When you open the workbook next time, click the Enable Content button in the security warning bar.
Please try, thank you!
This comment was minimized by the moderator on the site
Hi i want to sum up every 4 row, but my new table for these sum-up values has an interval of every 12 rows, any idea?
Ex: Sum-up every 4 months data and put those data in a new table at every new year Jan (12 interval row).
This comment was minimized by the moderator on the site
Sorry final question is there a way this can be done in one array in a Sumproduct formula as I'd like the values to still be kept individually.
This comment was minimized by the moderator on the site
That VBA code is helpful, can it be amended so it also sums the first value of the sequence?
This comment was minimized by the moderator on the site
These vma tutorials are the best thing ever. Very helpful thank you guys!
This comment was minimized by the moderator on the site
The formula is not working for the column can anyone please help me to add odd column
This comment was minimized by the moderator on the site
Hi, Nilesh,
If you want to sum the cell values in all odd row, the below formula may help you! (Please change the cell references to your need.)

=SUMPRODUCT(B1:B15,MOD(ROW(B1:B15)+0,2))

Please try, hope it can help you!
This comment was minimized by the moderator on the site
Is there a way to add another criteria to this formula? I want to add every 9th row that is great than -40. I would appreciate your help. Thanks in advance!
This comment was minimized by the moderator on the site
Used the visual basic programming – excellent! The other options worked fine except for row n.º 1.
This comment was minimized by the moderator on the site
sir I have used visual basic for SumIntervalCols function as stated above and saved the file as macro enable worksheet. when next time open the file the user define command is missing from drop down function menu Please help how to fix user define macro and can be used for other excel sheets. regards D KUMAR
This comment was minimized by the moderator on the site
This method does not work for me. I entered the 15 numbers in the column B (B1:B15) as in the example and copy the formula to a blank cell, the result is 0. If I change the if statement to IF(MOD(ROW($B$1:$B$15),2)=1, the result is 3795 that is sum(B1:B15). What is wrong?
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