Add every 32nd cell in a column

shorie7

New Member
Joined
Aug 25, 2014
Messages
8
Hello,
I have a spreadsheet where I need to total every 32nd cell at the end of the sheet.
I keep trying in say, cell M1800 this formula...

=j20+j52+j84 etc.

This would work, but I have to add like 53 additions.. And then I got the same problem in different parts of the sheet.

Does anyone know an easier way please?
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Try: =SUMPRODUCT(--(MOD(J:J,32)=1),J:J)
 
Upvote 0
Try
=SUMPRODUCT(--(MOD(ROW(F:F),32)=1),F:F)
 
Upvote 0
Here is a VBA solution
Code:
Option Explicit


Sub Every32()
    Dim lr As Long
    Dim i As Long, x As Double
    lr = Range("J" & Rows.Count).End(xlUp).Row
    x = 0
    For i = 20 To lr
        x = x + Range("J" & i)
        i = i + 32
    Next i
    MsgBox ("total = " & x)
End Sub

Standard Module
How to install your new code
Copy the Excel VBA code
Select the workbook in which you want to store the Excel VBA code
Press Alt+F11 to open the Visual Basic Editor
Choose Insert > Module
Edit > Paste the macro into the module that appeared
Close the VBEditor
Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)


To run the Excel VBA code:
Press Alt-F8 to open the macro list
Select a macro in the list
Click the Run button
 
Upvote 0
Starting at J20

consider

=J20+SUMPRODUCT(--(MOD(ROW(A20:A1200)-20,32)=0),J20:J1200)-20
 
Upvote 0
ignore post 7. I posted incorrect information.

try

=SUMPRODUCT(--(MOD(ROW(A20:A1200)-20,32)=0),J20:J1200)
 
Upvote 0
hello,
i have a spreadsheet where i need to total every 32nd cell at the end of the sheet.
I keep trying in say, cell m1800 this formula...

=j20+j52+j84 etc.

This would work, but i have to add like 53 additions.. And then i got the same problem in different parts of the sheet.

Does anyone know an easier way please?


=sumproduct(j20:j400,--(mod(row(j20:j400)-row(j20),32)=0))
 
Upvote 0
Just a caution with Alan Sidman's VBA solution.

It appears to yield an incorrect total; it does not appear to add the cells per the request.
 
Upvote 0

Forum statistics

Threads
1,214,958
Messages
6,122,475
Members
449,087
Latest member
RExcelSearch

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