#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,069
Default Totaling columns

I was so impressed with the wonderful responses and spot on answers to my
first question on this site I thought I would give this one a try. I did try
to research to find this on the site, but perhaps I am wording my search
incorrectly.
My question is: On my download I run a macro that I have set up do
calculations on my worksheet.
1.Each time the report is ran it would have varying information and
varying numer of lines.
For each run of the report the columns below would a have the following in
common, but again each run would have a varying amount of rows)
2. Col A will have some blanks in the cells
3. Col B, C, D & E will have the same number of rows (no blanks in cells)
4. Col G, H & I will have the same number of rows (no blanks in cells)
5. Col K, L, M, & N will have the same number of rows (no blanks in cells)
6. Col P,Q,R,S & T will have the same number of rows (no blanks in cells)

· I would like to go to the last cell with data of each column individually
(E, I, N, & Q) and put the totals on the line below. (totals will not be on
the same row).
· Also as an alternative, I may like the totals all on the same row (find
the last cell with data, go to the next row below and total those columns all
on the same row.
· Whew, I think thats about all.
Thanks for trying to solve this.
John
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,942
Default Totaling columns

hi
something like this might work for you..
Dim lr As Long
lr = [E2].End(xlDown).Row
[E2].End(xlDown).Offset(1, 0).Formula = "=SUM(E2:E" & lr & ")"

you would only need to dim lr once but would need to re assign the row value
for each formula since you say they are all different. the above is for E
column

lr = [I2].End(xlDown).Row
[I2].End(xlDown).Offset(1, 0).Formula = "=SUM(I2:I" & lr & ")"

the above would be for I column. and you would need the two lines above for
each column that you wanted to put the formula in. just adjust the cell
references.
the above assumes no blanks in column. if you ever do have blanks in the
data, you can find the last row from the bottom ie...

lr = [E65000].End(xlup).Row
or
lr = cells(rows.count, "E").end(xlup).row

regards
FSt1

"John" wrote:

I was so impressed with the wonderful responses and spot on answers to my
first question on this site I thought I would give this one a try. I did try
to research to find this on the site, but perhaps I am wording my search
incorrectly.
My question is: On my download I run a macro that I have set up do
calculations on my worksheet.
1.Each time the report is ran it would have varying information and
varying numer of lines.
For each run of the report the columns below would a have the following in
common, but again each run would have a varying amount of rows)
2. Col A will have some blanks in the cells
3. Col B, C, D & E will have the same number of rows (no blanks in cells)
4. Col G, H & I will have the same number of rows (no blanks in cells)
5. Col K, L, M, & N will have the same number of rows (no blanks in cells)
6. Col P,Q,R,S & T will have the same number of rows (no blanks in cells)

· I would like to go to the last cell with data of each column individually
(E, I, N, & Q) and put the totals on the line below. (totals will not be on
the same row).
· Also as an alternative, I may like the totals all on the same row (find
the last cell with data, go to the next row below and total those columns all
on the same row.
· Whew, I think thats about all.
Thanks for trying to solve this.
John

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,069
Default Totaling columns

Thank you that works perfectly. I appoligize, I did forget to include that it
is possible that there would be no data to total in column I, N, & Q. Is
there a way to accomodate for that scenerio so it does not error out?
John


"FSt1" wrote:

hi
something like this might work for you..
Dim lr As Long
lr = [E2].End(xlDown).Row
[E2].End(xlDown).Offset(1, 0).Formula = "=SUM(E2:E" & lr & ")"

you would only need to dim lr once but would need to re assign the row value
for each formula since you say they are all different. the above is for E
column

lr = [I2].End(xlDown).Row
[I2].End(xlDown).Offset(1, 0).Formula = "=SUM(I2:I" & lr & ")"

the above would be for I column. and you would need the two lines above for
each column that you wanted to put the formula in. just adjust the cell
references.
the above assumes no blanks in column. if you ever do have blanks in the
data, you can find the last row from the bottom ie...

lr = [E65000].End(xlup).Row
or
lr = cells(rows.count, "E").end(xlup).row

regards
FSt1

"John" wrote:

I was so impressed with the wonderful responses and spot on answers to my
first question on this site I thought I would give this one a try. I did try
to research to find this on the site, but perhaps I am wording my search
incorrectly.
My question is: On my download I run a macro that I have set up do
calculations on my worksheet.
1.Each time the report is ran it would have varying information and
varying numer of lines.
For each run of the report the columns below would a have the following in
common, but again each run would have a varying amount of rows)
2. Col A will have some blanks in the cells
3. Col B, C, D & E will have the same number of rows (no blanks in cells)
4. Col G, H & I will have the same number of rows (no blanks in cells)
5. Col K, L, M, & N will have the same number of rows (no blanks in cells)
6. Col P,Q,R,S & T will have the same number of rows (no blanks in cells)

· I would like to go to the last cell with data of each column individually
(E, I, N, & Q) and put the totals on the line below. (totals will not be on
the same row).
· Also as an alternative, I may like the totals all on the same row (find
the last cell with data, go to the next row below and total those columns all
on the same row.
· Whew, I think thats about all.
Thanks for trying to solve this.
John

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,942
Default Totaling columns

hi
i covered that scenerio with comments at the bottom of my post. simply
substitute the line of code i suppied.

regards
FSt1

"John" wrote:

Thank you that works perfectly. I appoligize, I did forget to include that it
is possible that there would be no data to total in column I, N, & Q. Is
there a way to accomodate for that scenerio so it does not error out?
John


"FSt1" wrote:

hi
something like this might work for you..
Dim lr As Long
lr = [E2].End(xlDown).Row
[E2].End(xlDown).Offset(1, 0).Formula = "=SUM(E2:E" & lr & ")"

you would only need to dim lr once but would need to re assign the row value
for each formula since you say they are all different. the above is for E
column

lr = [I2].End(xlDown).Row
[I2].End(xlDown).Offset(1, 0).Formula = "=SUM(I2:I" & lr & ")"

the above would be for I column. and you would need the two lines above for
each column that you wanted to put the formula in. just adjust the cell
references.
the above assumes no blanks in column. if you ever do have blanks in the
data, you can find the last row from the bottom ie...

lr = [E65000].End(xlup).Row
or
lr = cells(rows.count, "E").end(xlup).row

regards
FSt1

"John" wrote:

I was so impressed with the wonderful responses and spot on answers to my
first question on this site I thought I would give this one a try. I did try
to research to find this on the site, but perhaps I am wording my search
incorrectly.
My question is: On my download I run a macro that I have set up do
calculations on my worksheet.
1.Each time the report is ran it would have varying information and
varying numer of lines.
For each run of the report the columns below would a have the following in
common, but again each run would have a varying amount of rows)
2. Col A will have some blanks in the cells
3. Col B, C, D & E will have the same number of rows (no blanks in cells)
4. Col G, H & I will have the same number of rows (no blanks in cells)
5. Col K, L, M, & N will have the same number of rows (no blanks in cells)
6. Col P,Q,R,S & T will have the same number of rows (no blanks in cells)

· I would like to go to the last cell with data of each column individually
(E, I, N, & Q) and put the totals on the line below. (totals will not be on
the same row).
· Also as an alternative, I may like the totals all on the same row (find
the last cell with data, go to the next row below and total those columns all
on the same row.
· Whew, I think thats about all.
Thanks for trying to solve this.
John

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,069
Default Totaling columns

Sorry, Yes that works and will save me alot of time, Thank you very much
--
John


"FSt1" wrote:

hi
i covered that scenerio with comments at the bottom of my post. simply
substitute the line of code i suppied.

regards
FSt1

"John" wrote:

Thank you that works perfectly. I appoligize, I did forget to include that it
is possible that there would be no data to total in column I, N, & Q. Is
there a way to accomodate for that scenerio so it does not error out?
John


"FSt1" wrote:

hi
something like this might work for you..
Dim lr As Long
lr = [E2].End(xlDown).Row
[E2].End(xlDown).Offset(1, 0).Formula = "=SUM(E2:E" & lr & ")"

you would only need to dim lr once but would need to re assign the row value
for each formula since you say they are all different. the above is for E
column

lr = [I2].End(xlDown).Row
[I2].End(xlDown).Offset(1, 0).Formula = "=SUM(I2:I" & lr & ")"

the above would be for I column. and you would need the two lines above for
each column that you wanted to put the formula in. just adjust the cell
references.
the above assumes no blanks in column. if you ever do have blanks in the
data, you can find the last row from the bottom ie...

lr = [E65000].End(xlup).Row
or
lr = cells(rows.count, "E").end(xlup).row

regards
FSt1

"John" wrote:

I was so impressed with the wonderful responses and spot on answers to my
first question on this site I thought I would give this one a try. I did try
to research to find this on the site, but perhaps I am wording my search
incorrectly.
My question is: On my download I run a macro that I have set up do
calculations on my worksheet.
1.Each time the report is ran it would have varying information and
varying numer of lines.
For each run of the report the columns below would a have the following in
common, but again each run would have a varying amount of rows)
2. Col A will have some blanks in the cells
3. Col B, C, D & E will have the same number of rows (no blanks in cells)
4. Col G, H & I will have the same number of rows (no blanks in cells)
5. Col K, L, M, & N will have the same number of rows (no blanks in cells)
6. Col P,Q,R,S & T will have the same number of rows (no blanks in cells)

· I would like to go to the last cell with data of each column individually
(E, I, N, & Q) and put the totals on the line below. (totals will not be on
the same row).
· Also as an alternative, I may like the totals all on the same row (find
the last cell with data, go to the next row below and total those columns all
on the same row.
· Whew, I think thats about all.
Thanks for trying to solve this.
John

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sorting and sub totaling columns dmills Excel Discussion (Misc queries) 2 February 12th 09 08:11 PM
Columns not totaling unless you save worksheet Lori G Excel Discussion (Misc queries) 3 January 7th 08 06:54 PM
Totaling columns of text in Excel Classy D Excel Worksheet Functions 3 March 6th 06 11:07 PM
Totaling criteria from 2 columns alexy Excel Worksheet Functions 13 August 4th 05 03:12 PM
Totaling Columns DNA Excel Discussion (Misc queries) 1 May 5th 05 01:40 PM


All times are GMT +1. The time now is 04:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"