MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Adding non-adjacent rows


Posted by Suzi on December 13, 2001 8:52 PM

I need help with creating a formula that will add every other row for ~300 rows. FYI - There are 13 columns in the data base. I am not sure if you need that info or not. Any help would be greatly appreciated. Suzi


Posted by Jacob on December 13, 2001 9:13 PM

Here is a quick fix

To add stuff in column A1:A300
Sub AddEmUp()

Dim MyTotal
X=1
a:
If x > 299 Then Goto z:
range("A" & X).select
MyTotal=MyTotal+activecell.value
x=x+2
goto a:
z:
Msgbox(Mytotal)
End Sub

Hope this helps

Jacob

Posted by Alonso on December 14, 2001 3:07 AM

=SUM(IF(MOD(ROW(A1:A300),2)=1,A1:A300)) (Enter by Ctrl+Shift+Enter)