A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Totaling columns



 
 
Thread Tools Display Modes
  #1  
Old June 5th, 2010, 03:22 AM posted to microsoft.public.excel.worksheet.functions
John
external usenet poster
 
Posts: 2,649
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 that’s about all.
Thanks for trying to solve this.
John
  #2  
Old June 5th, 2010, 05:34 AM posted to microsoft.public.excel.worksheet.functions
FSt1
external usenet poster
 
Posts: 2,788
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 that’s about all.
Thanks for trying to solve this.
John

  #3  
Old June 5th, 2010, 11:12 AM posted to microsoft.public.excel.worksheet.functions
John
external usenet poster
 
Posts: 2,649
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 that’s about all.
Thanks for trying to solve this.
John

  #4  
Old June 5th, 2010, 01:54 PM posted to microsoft.public.excel.worksheet.functions
FSt1
external usenet poster
 
Posts: 2,788
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 that’s about all.
Thanks for trying to solve this.
John

  #5  
Old June 6th, 2010, 03:15 AM posted to microsoft.public.excel.worksheet.functions
John
external usenet poster
 
Posts: 2,649
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 that’s about all.
Thanks for trying to solve this.
John

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


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