Sum every other column

himperson1

New Member
Joined
Jun 23, 2016
Messages
33
Hello all,

I am looking for a formula to sum the contents of every other column/array. i am currently using
=SUMPRODUCT(--(MOD(COLUMN(A1:E1)-COLUMN(A1)+1,2)=1),A1:E1) which works great for adding every other CELL in row 1, but I am looking to add the cells below those as well

ex: adding every odd column
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5

<tbody>
</tbody>


I am trying to get the sum (3+9+15)=27
 
Last edited:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

himperson1

New Member
Joined
Jun 23, 2016
Messages
33
this worked, thank you.

i have altered it to suit my needs which results in:

=SUMPRODUCT(MOD(COLUMN(A1:E3)-COLUMN(A1)+1,2)*A1:E3)

so that the array can begin in any column
 

himperson1

New Member
Joined
Jun 23, 2016
Messages
33
this worked, thank you.

i have altered it to suit my needs which results in:

=SUMPRODUCT(MOD(COLUMN(A1:E3)-COLUMN(A1)+1,2)*A1:E3)

so that the array can begin in any column
For posterity:

=SUMPRODUCT(--(MOD(COLUMN(A1:E1)-COLUMN(A1)+1,X)=1),A1:E1)

using this version, changing X to any n digit will correctly allow summation of every other nth column starting anywhere on the worksheet. previous iteration only works for every other column (X = 2).
 
Last edited:

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
For posterity:

=SUMPRODUCT(--(MOD(COLUMN(A1:E1)-COLUMN(A1)+1,X)=1),A1:E1)

using this version, changing X to any n digit will correctly allow summation of every other nth column starting anywhere on the worksheet. previous iteration only works for every other column (X = 2).

I introduced this eons ago... what I call the robust approach:

1.

=SUMPRODUCT(--(MOD(COLUMN(A1:E1)-COLUMN(A1),X)=0),A1:E1)

which begins summing with the first cell of the reference.

2.

=SUMPRODUCT(--(MOD(COLUMN(A1:E1)-COLUMN(A1)+1,X)=0),A1:E1)

which begins summing with the Xth cell of the reference.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,903
Messages
5,834,309
Members
430,276
Latest member
legalcriminal015

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
Top