Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 349
Default Sum up a dynamic range

Dear all,

I want to create a function (maybe just a common IW question in fact) to sum
up a column, which have a dynamic number of rows!

My user will retrieve data from DB and display in a column, but the number
of row of this column is subjected to change, so I can't hardcode
"=SUM(A1:A10)" at the end of the column. So I'd like to know how I can sum
and display the total right after the last cell of that dynamic column?

Thanks,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Sum up a dynamic range

Hello
Use a dynamic name for your range using this formula in the "refers To"
field:
=OFFSET(A1;;;COUNTA(A:A))
Then use this new name in your formula (which obviously must NOT be placed
in column A):
=Sum(YourName)

HTH
Cordially
Pascal

"Peter" a écrit dans le message de news:
...
Dear all,

I want to create a function (maybe just a common IW question in fact) to
sum
up a column, which have a dynamic number of rows!

My user will retrieve data from DB and display in a column, but the number
of row of this column is subjected to change, so I can't hardcode
"=SUM(A1:A10)" at the end of the column. So I'd like to know how I can sum
and display the total right after the last cell of that dynamic column?

Thanks,



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Sum up a dynamic range


lastrow = Columns("A:A").Find("*", [A1], , , xlByRows, xlPrevious).Row
Range("A" & lastrow+1).formula="=SUM(A1:A" & lastrow & ")"


Regards,
Stefi

€˛Peter€¯ ezt Ć*rta:

Dear all,

I want to create a function (maybe just a common IW question in fact) to sum
up a column, which have a dynamic number of rows!

My user will retrieve data from DB and display in a column, but the number
of row of this column is subjected to change, so I can't hardcode
"=SUM(A1:A10)" at the end of the column. So I'd like to know how I can sum
and display the total right after the last cell of that dynamic column?

Thanks,

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Sum up a dynamic range

How about putting the formula

=SUM(A2:A65535)

in the first row, makes it easier to find as well.

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"Peter" wrote in message
...
Dear all,

I want to create a function (maybe just a common IW question in fact) to

sum
up a column, which have a dynamic number of rows!

My user will retrieve data from DB and display in a column, but the number
of row of this column is subjected to change, so I can't hardcode
"=SUM(A1:A10)" at the end of the column. So I'd like to know how I can sum
and display the total right after the last cell of that dynamic column?

Thanks,



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
getting the absolute range address from a dynamic named range junoon Excel Programming 2 March 21st 06 01:29 PM
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM
copying dynamic range based on cell outside of range xcelelder Excel Programming 3 September 29th 05 05:08 PM
select dynamic range with dynamic start point Juli Excel Programming 1 August 31st 05 12:05 AM
Excel 2000 VBA - Set Print Range in dynamic range sub_pop[_5_] Excel Programming 2 July 27th 04 08:01 PM


All times are GMT +1. The time now is 06:39 AM.

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"