Sum Every Nth Row

Excel Formulas › Sum

All versionsSUMPRODUCTMOD

Sometimes you need to add only every 3rd row — a value that repeats in a pattern, totals scattered at a fixed interval. SUMPRODUCT with MOD builds a TRUE/FALSE mask of the rows you want and sums just those.


Quick formula: to sum every 3rd value in B2:B13:
=SUMPRODUCT((MOD(ROW(B2:B13)-ROW(B2), 3)=0) * B2:B13)
MOD(…, 3)=0 is TRUE on rows 0, 3, 6… from the start; SUMPRODUCT multiplies the mask by the values and adds them.

Functions used (tap for the full reference guide):

The example

Add every 3rd row (rows 2, 5, 8…).

AB
1ItemValue
21$10
32$20
43$30
54$40
65$50
7Sum of every 3rd:$50

The formula

The pattern sum (rows 2 and 5: $10 + $40):

=SUMPRODUCT((MOD(ROW(B2:B6)-ROW(B2), 3)=0) * B2:B6) // $10 + $40 = $50

How it works

The MOD expression builds a mask of which rows to keep:

  1. ROW(B2:B6)-ROW(B2) numbers the rows from 0: {0,1,2,3,4}.
  2. MOD(…, 3)=0 is TRUE wherever that count divides evenly by 3 — positions 0 and 3 → {TRUE,FALSE,FALSE,TRUE,FALSE}.
  3. Multiplying the mask by B2:B6 zeroes out the unwanted rows, leaving {10,0,0,40,0}.
  4. SUMPRODUCT adds them — 50. Change the 3 to sum every 2nd, 4th, etc.

Want a different starting offset? Change which row you subtract. Subtracting ROW(B2)-1 shifts the pattern so it picks rows 1, 4, 7… instead.

Try it: interactive demo

Live demo

Choose the interval; see which rows are summed.

row(s)
Total:   rows:

Variations

Sum every other row (even/odd)

Interval of 2 picks alternating rows:

=SUMPRODUCT((MOD(ROW(B2:B13)-ROW(B2), 2)=0) * B2:B13)

Sum every Nth column instead

Swap ROW for COLUMN:

=SUMPRODUCT((MOD(COLUMN(B2:M2)-COLUMN(B2), 3)=0) * B2:M2)

Average every Nth row

Divide by the count of kept rows:

=SUMPRODUCT((MOD(ROW(B2:B13)-ROW(B2),3)=0)*B2:B13) / SUMPRODUCT(--(MOD(ROW(B2:B13)-ROW(B2),3)=0))

Pitfalls & errors

Forgetting -ROW(B2). Using raw ROW() ties the pattern to absolute sheet rows, so inserting rows above breaks it. Always subtract the first row to count from zero.

Off-by-one on the offset. =0 starts the pattern on the first row; use =1 or =2 to shift which rows are picked.

Text in the value range can cause #VALUE! inside SUMPRODUCT. Keep the summed range numeric, or wrap values in N().

Practice workbook

📊
Download the free Sum Every Nth Row practice workbook
A value column with live every-Nth-row sum, the every-other-row and average variants, plus 4 challenges with answers. No sign-up required.

Frequently asked questions

How do I sum every Nth row in Excel?
Use =SUMPRODUCT((MOD(ROW(range)-ROW(first_cell), N)=0) * range). The MOD test builds a mask of every Nth row and SUMPRODUCT adds just those values.
How do I sum every other row?
Use an interval of 2: =SUMPRODUCT((MOD(ROW(range)-ROW(first_cell), 2)=0) * range) sums alternating rows.
Why does my every-Nth-row sum break when I insert rows?
You likely used ROW() without subtracting the first cell's row, which ties the pattern to absolute sheet positions. Subtract ROW(first_cell) so it counts from zero.

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: Sum by month · Running total · Sum if cell contains

Function references: SUMPRODUCT · MOD · ROW