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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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
 
Upvote 0
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:
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,824
Messages
6,121,783
Members
449,049
Latest member
greyangel23

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