Excel guide · 4 min read
Sum every other row (or every nth row) in Excel
=SUMPRODUCT((MOD(SEQUENCE(ROWS(C2:C9)),2)=0)*C2:C9) to add the 2nd, 4th, 6th... values in C2:C9. Change =0 to =1 for the 1st, 3rd, 5th... rows, and change the 2 to 3 for every third row. If the rows have a label next to them, =SUMIF(B2:B9,"Revenue",C2:C9) is simpler and safer.Sample data
Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Store | Line | Q3 | Shift | Calls | |
| 2 | Leeds | Units | 1240 | Mon early | 42 | |
| 3 | Leeds | Revenue | 18600 | Mon late | 35 | |
| 4 | York | Units | 980 | Mon night | 12 | |
| 5 | York | Revenue | 14210 | Tue early | 47 | |
| 6 | Hull | Units | 1105 | Tue late | 31 | |
| 7 | Hull | Revenue | 16575 | Tue night | 9 | |
| 8 | Bath | Units | 760 | Wed early | 39 | |
| 9 | Bath | Revenue | 11780 | Wed late | 38 | |
| 10 | Wed night | 14 |
Download this sheet as an Excel practice file (.xlsx)
Every other row with SUMPRODUCT and MOD
Exported reports often stack two lines per item. Here each store has a Units row and then a Revenue row, so the revenue figures are every second value in C2:C9. A plain SUM(C2:C9) mixes units and dollars and gives a meaningless 65,250.
SEQUENCE(ROWS(C2:C9)) numbers the rows of the range 1 to 8. MOD(...,2) gives the remainder after dividing by 2: 1 for odd positions, 0 for even ones. Testing =0 keeps positions 2, 4, 6 and 8, which are the Revenue rows. SUMPRODUCT multiplies each TRUE (1) or FALSE (0) by the value next to it and adds the results.
Result: 61165
61,165: the four Revenue rows (18,600 + 14,210 + 16,575 + 11,780). Change =0 to =1 and you get 4,085, the Units rows.
Every 3rd row (or every nth row)
The call log in E1:F10 has three shifts per day: early, late and night. To total just the night shifts, take every third value. The only change is the divisor in MOD: 3 instead of 2.
With MOD(position,3), positions 3, 6 and 9 give a remainder of 0. Test =1 for positions 1, 4, 7 (the early shifts) or =2 for 2, 5, 8 (the late shifts). For every 4th or 5th row, put that number in place of the 3. A cleaner version keeps n in a cell, say H2, and uses MOD(...,H2)=0, so you can change it without editing the formula.
Result: 35
35 night calls: 12 + 9 + 14. Testing =1 instead gives 128, the early shifts.
The safer layout: sum by label with SUMIF
Position-based formulas break quietly. If someone inserts a Margin row for one store, every row below it shifts by one and the "every other row" total starts adding units to revenue. Nothing turns red; the number is just wrong.
When the data has a label column, use it. SUMIF picks rows by what they are, not where they sit, so inserted, deleted or re-sorted rows cannot throw it off. This is the method to pick for anything that gets edited or refreshed. If there is no label column, adding one is usually a better fix than a clever formula.
Result: 61165
61,165, the same as the SUMPRODUCT version, but it stays right if rows are added or reordered.
Labels that are only part of the text: wildcards
The shift labels combine the day and the shift ("Mon night"), so there is no column that says just "night". A wildcard handles it: "*night" means "anything, then the word night at the end". Use "*night*" if the word could appear anywhere in the label.
To add a second condition, switch to SUMIFS, which puts the sum range first: =SUMIFS(C2:C9,B2:B9,"Revenue",A2:A9,"<>Bath") gives 49,385, revenue for every store except Bath.
Result: 35
35, matching the every-3rd-row result, without depending on the row order.
The header-row trap
If you select C1:C9 instead of C2:C9, two things go wrong. With the * form, SUMPRODUCT multiplies the text "Q3" by a number and returns #VALUE!. With the comma form below, text counts as 0 so there is no error, but the header now sits at position 1, which shifts everything: position 2 is Leeds Units, not Leeds Revenue.
So the comma form silently sums the Units rows. Always start the range on the first data row, and check the answer once by hand on a small block.
Result: 4085
4,085: the Units total, not revenue, because including the header moved every row one position along.
Older Excel and other options
SEQUENCE needs Excel 365 or Excel 2021 and later. In older versions, use ROW to build the positions: =SUMPRODUCT((MOD(ROW(C2:C9)-ROW(C2),2)=1)*C2:C9) gives the same revenue total. Subtracting ROW(C2) makes the count start at 0 on the first row of the range, so the formula still works if the data moves down the sheet.
In Excel 365 you can also write =SUM(FILTER(C2:C9,MOD(SEQUENCE(ROWS(C2:C9)),2)=0)), which reads well but returns #CALC! if no row matches. A third option needs no formula skills: add a helper column, mark each row you want, and SUMIF on that column.
- Insert a column next to the data and type a header such as Keep.
- In the first two data rows type 0 and 1 (or 0, 0, 1 for every 3rd row).
- Select those cells and double-click the fill handle to repeat the pattern down the column.
- Total the marked rows with
=SUMIF(helper_range,1,C2:C9).
Common mistakes
The range starts on the header row
Start on the first data row (C2, not C1). Including the header either gives #VALUE! or shifts which rows are counted.
Rows were inserted after the formula was written
Position-based formulas count every row in the range, including new ones. Use SUMIF on a label column so each row is picked by what it is.
Filtering to the Revenue rows and using SUM
SUM still adds the hidden rows. After filtering, use =SUBTOTAL(9,C2:C9), which skips rows hidden by a filter, or read the Sum on the status bar.
Expecting =0 to mean "first row"
MOD(position,2)=0 keeps the even positions (2, 4, 6...). Use =1 to start with the first row of the range.
FAQ
How do I sum every other row in Excel?
Use =SUMPRODUCT((MOD(SEQUENCE(ROWS(C2:C9)),2)=0)*C2:C9) for the 2nd, 4th, 6th rows, or =1 for the 1st, 3rd, 5th. In Excel 2019 and earlier, replace SEQUENCE(ROWS(C2:C9)) with ROW(C2:C9)-ROW(C2)+1.
How do I sum every 3rd row?
Change the 2 in MOD to 3: =SUMPRODUCT((MOD(SEQUENCE(ROWS(F2:F10)),3)=0)*F2:F10) adds positions 3, 6 and 9. Use =1 or =2 to start on the first or second row instead.
Can I sum every other column instead of every other row?
Yes. Use COLUMNS instead of ROWS and make SEQUENCE run across: =SUMPRODUCT((MOD(SEQUENCE(1,COLUMNS(B2:M2)),2)=0)*B2:M2). The same header and inserted-column warnings apply.
Why does my every-other-row formula return #VALUE!?
The range includes text, usually a header or a note, and the * form cannot multiply text. Start the range on the first number, or use the comma form SUMPRODUCT(--(test),range), which treats text as 0.
Functions used
SUMPRODUCTMultiply then addMODRemainder after divisionSEQUENCENumbered list, spillsSUMIFAdds cells that matchSUMIFSAdds with several conditionsFILTERKeeps matching rows, spillsSUMAdds numbers
Related guides
- How to use SUMPRODUCT in Excel
- SUMIF vs SUMIFS: what is the difference?
- SUMIFS with multiple criteria in Excel
- How to sum if a cell contains text in Excel
- SUMIF with OR: sum if a cell matches one of several values
- Get the quarter from a date in Excel
Updated