Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Summing data

I have a template sheet with data that has to be summed
up. The current range is C2:c314. However, the next time I
get the data the data range might be c2: c228.

The data will be contiguous (there won't be any gaps). Row
C1 is a header. I tried to record a macro by finding the
last active cell in Col C, going one cell down, typing =sum
(, hitting the up arrow key, CTRL + Shift + up arrow key,
and then hitting the down arrow key to get my data range.
This is what the code reads:

ActiveCell.FormulaR1C1 = "=SUM(R[-314]C:R[-1]C)"

Can any one help by correcting this so that from the
activecell in Col C it will add all the numbers except for
the topmost cell, C1?

I hope the question is clear.

Thanks for your help.

--Perry
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Summing data

Hi Perry
an non VBA solution:
=SUM(OFFSET($C$2,0,0,COUNTA($C:$C)-1)
if there are no blank rows in between

Frank


Perry Kew wrote:
I have a template sheet with data that has to be summed
up. The current range is C2:c314. However, the next time I
get the data the data range might be c2: c228.

The data will be contiguous (there won't be any gaps). Row
C1 is a header. I tried to record a macro by finding the
last active cell in Col C, going one cell down, typing =sum
(, hitting the up arrow key, CTRL + Shift + up arrow key,
and then hitting the down arrow key to get my data range.
This is what the code reads:

ActiveCell.FormulaR1C1 = "=SUM(R[-314]C:R[-1]C)"

Can any one help by correcting this so that from the
activecell in Col C it will add all the numbers except for
the topmost cell, C1?

I hope the question is clear.

Thanks for your help.

--Perry



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Summing data

set rng = Range("C1").End(xldown)(2)
rng.FormulaR1C1 = "=SUM(R2C:R[-1]C)"

--
Regards,
Tom Ogilvy


"Perry Kew" wrote in message
...
I have a template sheet with data that has to be summed
up. The current range is C2:c314. However, the next time I
get the data the data range might be c2: c228.

The data will be contiguous (there won't be any gaps). Row
C1 is a header. I tried to record a macro by finding the
last active cell in Col C, going one cell down, typing =sum
(, hitting the up arrow key, CTRL + Shift + up arrow key,
and then hitting the down arrow key to get my data range.
This is what the code reads:

ActiveCell.FormulaR1C1 = "=SUM(R[-314]C:R[-1]C)"

Can any one help by correcting this so that from the
activecell in Col C it will add all the numbers except for
the topmost cell, C1?

I hope the question is clear.

Thanks for your help.

--Perry



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Summing data

Since the sum formula is being placed below the data, this formula gives me
a circular reference error.

also, it is missing a final right parenthesis.
--
Regards,
Tom Ogilvy
"Frank Kabel" wrote in message
...
Hi Perry
an non VBA solution:
=SUM(OFFSET($C$2,0,0,COUNTA($C:$C)-1)
if there are no blank rows in between

Frank


Perry Kew wrote:
I have a template sheet with data that has to be summed
up. The current range is C2:c314. However, the next time I
get the data the data range might be c2: c228.

The data will be contiguous (there won't be any gaps). Row
C1 is a header. I tried to record a macro by finding the
last active cell in Col C, going one cell down, typing =sum
(, hitting the up arrow key, CTRL + Shift + up arrow key,
and then hitting the down arrow key to get my data range.
This is what the code reads:

ActiveCell.FormulaR1C1 = "=SUM(R[-314]C:R[-1]C)"

Can any one help by correcting this so that from the
activecell in Col C it will add all the numbers except for
the topmost cell, C1?

I hope the question is clear.

Thanks for your help.

--Perry





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Summing data

Hi Tom
you're right, I made the (eventually wrong) assumption that this
formula is placed in a different column

Frank

Tom Ogilvy wrote:
Since the sum formula is being placed below the data, this formula
gives me a circular reference error.

also, it is missing a final right parenthesis.
Hi Perry
an non VBA solution:
=SUM(OFFSET($C$2,0,0,COUNTA($C:$C)-1)
if there are no blank rows in between

Frank


Perry Kew wrote:
I have a template sheet with data that has to be summed
up. The current range is C2:c314. However, the next time I
get the data the data range might be c2: c228.

The data will be contiguous (there won't be any gaps). Row
C1 is a header. I tried to record a macro by finding the
last active cell in Col C, going one cell down, typing =sum
(, hitting the up arrow key, CTRL + Shift + up arrow key,
and then hitting the down arrow key to get my data range.
This is what the code reads:

ActiveCell.FormulaR1C1 = "=SUM(R[-314]C:R[-1]C)"

Can any one help by correcting this so that from the
activecell in Col C it will add all the numbers except for
the topmost cell, C1?

I hope the question is clear.

Thanks for your help.

--Perry





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Summing data

Thank you for your help.

set rng = Range("C1").End(xldown)(2)
Can you please tell me what the (2) means?

--Perry


-----Original Message-----
set rng = Range("C1").End(xldown)(2)
rng.FormulaR1C1 = "=SUM(R2C:R[-1]C)"

--
Regards,
Tom Ogilvy


"Perry Kew" wrote

in message
...
I have a template sheet with data that has to be summed
up. The current range is C2:c314. However, the next

time I
get the data the data range might be c2: c228.

The data will be contiguous (there won't be any gaps).

Row
C1 is a header. I tried to record a macro by finding the
last active cell in Col C, going one cell down, typing

=sum
(, hitting the up arrow key, CTRL + Shift + up arrow

key,
and then hitting the down arrow key to get my data

range.
This is what the code reads:

ActiveCell.FormulaR1C1 = "=SUM(R[-314]C:R[-1]C)"

Can any one help by correcting this so that from the
activecell in Col C it will add all the numbers except

for
the topmost cell, C1?

I hope the question is clear.

Thanks for your help.

--Perry



.

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
Summing Data Ruth Excel Worksheet Functions 3 October 21st 09 08:56 AM
Summing like data (2) nba Excel Discussion (Misc queries) 2 October 2nd 09 03:57 AM
Summing like data nba Excel Discussion (Misc queries) 5 September 29th 09 10:55 AM
summing data david72 Excel Discussion (Misc queries) 1 May 17th 06 04:15 AM
Summing data yesac142 Excel Discussion (Misc queries) 6 June 20th 05 01:47 PM


All times are GMT +1. The time now is 03:58 PM.

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

About Us

"It's about Microsoft Excel"