ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sum a column (https://www.excelbanter.com/excel-programming/292455-re-sum-column.html)

Nick Cranham

Sum a column
 
newbie04,
How do you know which values in LHS are true values and which are sums of
the numbers above ?

NickHK

"newbie04 " wrote in message
...
i have a series of data :

2 2
5 5
7
1 1
0 0
3 3
6 6
10
2 2
9 9
11

The LHS is the original data while the RHS is the data i wanna obtain.
My doubts is that what is the code for summing?

Thank you.


---
Message posted from http://www.ExcelForum.com/




newbie04[_2_]

Sum a column
 
Hi nick,

okie, my original data is shown
2
5

1
0
3
6

2
9

And i wanna get the result:
2
5
7
1
0
3
6
10
2
9
11

I know the logic to scan the empty column and do the sum, but it seem
that z is not valid here. May i know why?

Worksheets(a).cells(i,j)Select
ActiveCell.formula = "=SUM(R[-z]C:R[-1]C)

--
Message posted from http://www.ExcelForum.com


Nick Cranham

Sum a column
 
newbie04,
If your data is split like that, with an empty line between, one way is to
use Data -- Subtotal menu to achieve what you want. That way Excel takes
care of which are real values and which are (sub) totals.

NickHK

"newbie04 " wrote in message
...
Hi nick,

okie, my original data is shown
2
5

1
0
3
6

2
9

And i wanna get the result:
2
5
7
1
0
3
6
10
2
9
11

I know the logic to scan the empty column and do the sum, but it seems
that z is not valid here. May i know why?

Worksheets(a).cells(i,j)Select
ActiveCell.formula = "=SUM(R[-z]C:R[-1]C)"


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 08:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com