Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Assign the cell address with a function

Hi all,
I want to calculate the sum of a column, for example the sum from A1 to A10
which is the function =sum(A1:A10). But instead of A10 which identifies the
last cell of the sum, I want the row number to be taken from a function that
returns an integer number. Thus, the last cell of the sum in the row may be
A10 or A12 etc according to the integer which my function will return. Can
anybody help me? If I should program it with macros how can I do that? Thanks
in advance.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Assign the cell address with a function

On Thu, 8 Feb 2007 17:16:00 -0800, T.Mad
wrote:

Hi all,
I want to calculate the sum of a column, for example the sum from A1 to A10
which is the function =sum(A1:A10). But instead of A10 which identifies the
last cell of the sum, I want the row number to be taken from a function that
returns an integer number. Thus, the last cell of the sum in the row may be
A10 or A12 etc according to the integer which my function will return. Can
anybody help me? If I should program it with macros how can I do that? Thanks
in advance.


You could use a formula of the type:

=SUM(OFFSET(A1,0,0,last_cell_row))

You'll have to adjust last_cell_row depending on the row of the first cell.

So if you don't start at A1, then the formula might have to be:

=SUM(OFFSET(A1,0,0,last_cell_row - ROW(first_cell_address)+1))






--ron
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 18
Default Assign the cell address with a function

Thx ron U been very helpful!!!!

"Ron Rosenfeld" wrote:

On Thu, 8 Feb 2007 17:16:00 -0800, T.Mad
wrote:

Hi all,
I want to calculate the sum of a column, for example the sum from A1 to A10
which is the function =sum(A1:A10). But instead of A10 which identifies the
last cell of the sum, I want the row number to be taken from a function that
returns an integer number. Thus, the last cell of the sum in the row may be
A10 or A12 etc according to the integer which my function will return. Can
anybody help me? If I should program it with macros how can I do that? Thanks
in advance.


You could use a formula of the type:

=SUM(OFFSET(A1,0,0,last_cell_row))

You'll have to adjust last_cell_row depending on the row of the first cell.

So if you don't start at A1, then the formula might have to be:

=SUM(OFFSET(A1,0,0,last_cell_row - ROW(first_cell_address)+1))






--ron

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default Assign the cell address with a function

=SUM(B2:INDIRECT("B"&ROWS(B1:B100)))

"T.Mad" wrote:

Hi all,
I want to calculate the sum of a column, for example the sum from A1 to A10
which is the function =sum(A1:A10). But instead of A10 which identifies the
last cell of the sum, I want the row number to be taken from a function that
returns an integer number. Thus, the last cell of the sum in the row may be
A10 or A12 etc according to the integer which my function will return. Can
anybody help me? If I should program it with macros how can I do that? Thanks
in advance.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Assign the cell address with a function

On Thu, 8 Feb 2007 17:52:00 -0800, T.Mad
wrote:

Thx ron U been very helpful!!!!

"Ron Rosenfeld" wrote:

On Thu, 8 Feb 2007 17:16:00 -0800, T.Mad
wrote:

Hi all,
I want to calculate the sum of a column, for example the sum from A1 to A10
which is the function =sum(A1:A10). But instead of A10 which identifies the
last cell of the sum, I want the row number to be taken from a function that
returns an integer number. Thus, the last cell of the sum in the row may be
A10 or A12 etc according to the integer which my function will return. Can
anybody help me? If I should program it with macros how can I do that? Thanks
in advance.


You could use a formula of the type:

=SUM(OFFSET(A1,0,0,last_cell_row))

You'll have to adjust last_cell_row depending on the row of the first cell.

So if you don't start at A1, then the formula might have to be:

=SUM(OFFSET(A1,0,0,last_cell_row - ROW(first_cell_address)+1))






--ron


You're welcome. Glad to help.
--ron


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Assign the cell address with a function

Try this:

D1 = a formula that returns an integer row number (per your description)

=SUM(A1:INDEX(A:A,D1))

If D1 is empty the formula will calculate the entire range.

Biff

"T.Mad" wrote in message
...
Hi all,
I want to calculate the sum of a column, for example the sum from A1 to
A10
which is the function =sum(A1:A10). But instead of A10 which identifies
the
last cell of the sum, I want the row number to be taken from a function
that
returns an integer number. Thus, the last cell of the sum in the row may
be
A10 or A12 etc according to the integer which my function will return. Can
anybody help me? If I should program it with macros how can I do that?
Thanks
in advance.



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
Get cell address from macro function argument oscar New Users to Excel 3 June 1st 06 01:23 AM
ADDRESS function - dynamic input cell claytorm Excel Discussion (Misc queries) 1 June 28th 05 02:05 PM
Function syntax to compare cell contents ES Excel Worksheet Functions 2 May 18th 05 03:53 PM
How do I obtain the address of a cell using the vlookup function? Spock Excel Worksheet Functions 2 May 16th 05 06:35 PM
How do I use a function to return the address of a cell? ren6175 Excel Worksheet Functions 6 April 21st 05 03:13 PM


All times are GMT +1. The time now is 03:45 AM.

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"