Add cell in one column result in different column

sarah1024

New Member
Joined
Oct 15, 2018
Messages
7
Hello,
I need help with VBA code inserting sum of cells in column R in to column T which are separated by two empty rows.
values in column R starts at row 2.

Here is an example:

[TABLE="width: 150"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Column R[/TD]
[TD]Column T[/TD]
[/TR]
[TR]
[TD]258.05[/TD]
[TD]567.42[/TD]
[/TR]
[TR]
[TD]309.37[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]426.19[/TD]
[TD]930.44[/TD]
[/TR]
[TR]
[TD]504.25[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]608.14[/TD]
[TD]608.29[/TD]
[/TR]
[TR]
[TD]0.15[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I greatly appreciate the help!

Thank you!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hello,

Is there a real necessity to have VBA ... when a formula can perform the calculation ...? :wink:
 
Upvote 0
Welcome to the MrExcel board!

Assuming column R numbers are not the result of formulas, try this in a copy of your workbook.
Code:
Sub Insert_Sum()
  Dim rA As Range
  
  For Each rA In Columns("R").SpecialCells(xlConstants, xlNumbers).Areas
    rA.Cells(1, 3).Value = Application.Sum(rA)
  Next rA
End Sub
 
Upvote 0
Hello,

In cell T2, you can test the Array formula :

Code:
=SUM(OFFSET(R2,0,0,MATCH(TRUE,ISBLANK(R3:$R$100),0),1))

Hope this will help
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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