Sum every 'nth' row - NOT WORKING

CAT2016

New Member
Joined
Apr 13, 2016
Messages
6
Hi

I have been reading a few threads here today about adding cells together every 'nth' row and I am having some success and some failures. I have managed to add up a range of cells (every 6) in a column using this formula

=SUMPRODUCT($C$10:$C$154*(MOD(ROW($C$10:$C$154),6)=1))

but it doesn't add the last cell even though it is included in the range.

I am also adding up another range of cells, again every 6 in the same column but on a different line using this formula

=SUMPRODUCT($C$11:$C$154*(MOD(ROW($C$11:$C$154),6)=1))

but it gives me the same total as the cell above it, also a total cell of the first formula, even though all the cells indicated in the range are of a $0 amount.

I have tried the formula in various different ways and MrExcel's was the closest and most accurate but I just can't get the correct totals using this formula in each of the 'total' cells.

What am I doing wrong????

QUOTED TOTALS $4.00 $3.00 $0.00
ACTUAL TOTALS $4.00 $3.00 $0.00
 
Thanks for skipping... But the formula should be:

=SUMPRODUCT($C$10:$C$154,--(MOD(ROW($C$10:$C$154)-ROW($C$10)+1,6)=0))

for reasons of robustness.
@Aladin: so the difference is * in my formula, versus ,-- in your formula.
I understand both, but I wonder why ,-- would be more robust. Care to comment? Thanks.
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Enter a row in front of the current first data row and observe what happens.
Thanks, my formula keeps summing element 1, 7 etcetera, and yours element 6, 12 etcetera of the range, no matter how many rows are inserted.
I guess you are mistaking with the original formulas in post #1.
 
Upvote 0
Thanks, my formula keeps summing element 1, 7 etcetera, and yours element 6, 12 etcetera of the range, no matter how many rows are inserted.
I guess you are mistaking with the original formulas in post #1.

If every 7h is intended;

=SUMPRODUCT($C$10:$C$154,--(MOD(ROW($C$10:$C$154)-ROW($C$10),7)=0))
 
Upvote 0
Does something happen if you add further rows?

Neither will the formula in post #4.


Quote Originally Posted by Aladin Akyurek View Post

The formulas of post #6 (and of course post #14) won't break if you add rows in front of the current data area.
Neither will the formula in post #4.


I really don't know very much about Excel, but I am assuming, when you talk about adding rows in front of the current data areas, that the formula will no longer work?? If I am going to add any data it will be further down the spreadsheet, but then I would just amend the formula to reflect this, correct?

When I say I don't know much about Excel I really mean it so if you can explain things like you are talking to a three year old that would be great :biggrin: that is if you want to.
 
Last edited:
Upvote 0
Quote Originally Posted by Aladin Akyurek View Post

The formulas of post #6 (and of course post #14) won't break if you add rows in front of the current data area.
Neither will the formula in post #4.


I really don't know very much about Excel, but I am assuming, when you talk about adding rows in front of the current data areas, that the formula will no longer work?? If I am going to add any data it will be further down the spreadsheet, but then I would just amend the formula to reflect this, correct?

When I say I don't know much about Excel I really mean it so if you can explain things like you are talking to a three year old that would be great :biggrin: that is if you want to.

1. Are we summing every 7th?

2. What is the name of the sheet housing the data?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top