View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
[email protected] joeu2004@hotmail.com is offline
external usenet poster
 
Posts: 418
Default My first post - Please Help (Formula for adding Values)

Bob Phillips wrote:
=SUMPRODUCT(--(MOD(ROW(A1:A1000,4)=1)),A1:A1000)
this adds row 1,5,9, etc. if you want 2,6,10 change =1 to =2, 3,7,11 change
=1 to =3, and finally, 4,8,12 change =1 to =0


Besides the obvious typo (misplaced right parenthesis for MOD), the
problem with solutions like this, which rely simply on the MOD of the
row number, is that if the range is moved (e.g. insert a row above it),
the formula no longer works unless the user remembers to change it.

In this case, I prefer the more obvious array formulation, even though
I usually prefer to avoid array formulas. But if you are enamored to
arcane SUMPRODUCT formulations (ever wonder why so many people ask what
"--" means?), I would opt for combining the two ideas as follows:

=sumproduct( --(mod(row(A1:A1000)-row(A1),4)=0), A1:A1000 )

Of course, replace A1:A1000 with the correct range.