sum on every 17th column

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
Hello all,

I found this formula online, and It's just not quite working as intended.

Code:
=SUMPRODUCT((MOD(COLUMN($D4:$II4),17)=0)*($D4:$II4))
I'm wanting it to cum the value of every 17th cell, however when I change it to 17 it counts the 17th column first(q) then every 17, But I'm wanting the first column D counted then every 17th from there. How do I modify this?
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Since you're working on an array, you can simply minus the position of your starting column before it steps into every 17th position.
Code:
[COLOR=#333333]=SUMPRODUCT((MOD(COLUMN($D4:$II4)-COLUMN($D4),17)=0)*($D4:$II4))[/COLOR]

Also, you can always use Formula > Formula Auditing (Group) > Evaluate Formula to check and see how you're data is evaluated and do the necessary corrections.

If this answers your question, please take the time to hit the Like button on this response.
 
Upvote 0
Also, it might help to add, since the "SUMPRODUCT" can be very misleading, you can also use
Code:
=SUM((MOD(COLUMN($D4:$II4)-COLUMN($D4),17)=0)*($D4:$II4))
and instead of Enter, use CTRL+SHIFT+Enter... this makes it an array formula and provides the underlying formula with brackets around it.
Code:
{=SUM((MOD(COLUMN($D4:$II4)-COLUMN($D4),17)=0)*($D4:$II4))}

Advantage is - when you or somebody else reads the formula, it's more properly described as SUM which is your intention.
 
Upvote 0
I think it should be 4, and not 3... which is essentially the column index of D. Andrewb90 wanted to start the sum at column D, so the first array value should equal 0.

Hi,

Try this:

Code:
=SUMPRODUCT((MOD(COLUMN($D4:$II4)-3,17)=0)*($D4:$II4))
 
Upvote 0
I'm not sue why, but this isn't working either
Code:
[COLOR=#333333]=SUMPRODUCT((MOD(COLUMN($D4:$II4)-COLUMN($D4),17)=0)*($D4:$II4))[/COLOR]

To sum up what I am doing: I am trying to add: D4,T4,AJ4,AZ4, etc
 
Upvote 0
D to T is 16 counts. Formula you need is:
Code:
=SUMPRODUCT((MOD(COLUMN($D4:$II4)-COLUMN($D4),16)=0)*($D4:$II4))
 
Upvote 0
I think it should be 4, and not 3... which is essentially the column index of D.
=SUMPRODUCT((MOD(COLUMN($D4:$II4)-3,17)=0)*($D4:$II4)).

Andrewb90 wanted to start the sum at column D, so the first array value should equal 0.

If substract 4, then we have MOD ({0,1,2,3 ...}, 17) and MOD (0,17) = 0
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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