Sum every nth cell

Savvasy

New Member
Joined
Jun 20, 2019
Messages
6
Hi,

I have a spreadsheet with values from D3 up to AB3 and I would like to sum every 4th cell beginning from D3 (D3,H3,L3 etc..).
I've tried a lot of formulas including SUMPRODUCT, MOD, OFFSET but I always get errors and I believe the reason is because all my cells from D3 up to AB3 contain formulas.
Some of the formulas return numbers and some of them return percentages.

Your help would be much appreciated.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
I used to have it like this but I am adding cells with VBA and it does not sum the new cells

Ok, try this

To add from C3 to C52

Code:
Sub sum_col_c()
    Dim c As Long, l As String, i As Long
    c = Cells(3, Columns.Count).End(xlToLeft).Column
    l = Evaluate("=SUBSTITUTE(ADDRESS(1," & c & ",4),""1"","""")")
    For i = 3 To 52
        Range("C" & i) = Evaluate("=SUMPRODUCT((MOD(COLUMN(D" & i & ":" & l & i & "),4)=0)*D" & i & ":" & l & i & ")")
    Next
End Sub
 
Upvote 0
I tried your macro but it loses all the sumproduct formulas. It's like I am doing a copy/paste just numbers.
 
Upvote 0
I tried your macro but it loses all the sumproduct formulas. It's like I am doing a copy/paste just numbers.

That's the idea. Leaving only the results of the sums, otherwise, would also have the circular error.
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,984
Members
449,058
Latest member
oculus

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