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:

Some videos you may like

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

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,201
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,224
Messages
5,594,916
Members
413,952
Latest member
JGer

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