Sum Value in Every 2nd Cell in a Row, allowing for Columns to be Inserted

Simonc64

Active Member
Joined
Feb 15, 2007
Messages
251
Office Version
  1. 365
Hi I have a sheet, currently say with values in A1, A2, A3 and A4

In cell A5 i want to sum the values of A2+A4 (I know i can simply type =A2+A4 but my problem isn't that simple, this is just a scenario for ease of explanation), possibly using the MOD function? Something like where MOD(COLUMNS($A$2,A4)/2)=0 ?

I also want my sum value to update, say if someone inserted two columns, A5 and A6, meaning my sum calculation moved to A7, but calculated A2+A4+A6

Does that make any sense to anyone?

All help gratefully received
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Those are rows, not columns. Inserting columns would move your sum across the sheet (left to right), not down.

See if this does what you want it to
Excel Formula:
=SUMPRODUCT(A$2:INDEX(A:A,ROW()-1)*ISEVEN(ROW(A$2:INDEX(A:A,ROW()-1))))
 
Upvote 0
Those are rows, not columns. Inserting columns would move your sum across the sheet (left to right), not down.

See if this does what you want it to
Excel Formula:
=SUMPRODUCT(A$2:INDEX(A:A,ROW()-1)*ISEVEN(ROW(A$2:INDEX(A:A,ROW()-1))))
Apologies Jason youre totally right - been a long day already!

So i meant, values in A1,B1, C1 and D1 with the sum in E1 (B1+D1)

Two more columns entered with values in E1 and F1, so sum ends up in G1 but sums (B1+D1+F1)

Thanks for the code, i will let you know
 
Upvote 0
been a long day already!
And it's only just started ?

Going across instead of down you will need this version
Excel Formula:
=SUMPRODUCT($A2:INDEX(2:2,COLUMN()-1)*ISEVEN(COLUMN($A2:INDEX(2:2,COLUMN()-1))))
Which I was about to post originally, then noticed that the references were for rows so I changed it.
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,245
Members
448,555
Latest member
RobertJones1986

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