Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Art Art is offline
external usenet poster
 
Posts: 587
Default Return a range based on a variable

Column A contains these five numbers: 9,2,3,5,8
Cell A7 contains the number 4

I need a formula that does the following:
Sum the numbers in column A up to the number of rows in A7.

Formula evaluates to 19 (9+2+3+5)

Thanks,
--
Art
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Return a range based on a variable

Hi,

Try this

=SUM(INDIRECT("A1:A" & A7))

Mike

"Art" wrote:

Column A contains these five numbers: 9,2,3,5,8
Cell A7 contains the number 4

I need a formula that does the following:
Sum the numbers in column A up to the number of rows in A7.

Formula evaluates to 19 (9+2+3+5)

Thanks,
--
Art

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Art Art is offline
external usenet poster
 
Posts: 587
Default Return a range based on a variable

Mike, works perfectly.
Would you (or anyone smarter than me) explain how the formula works?
--
Art


"Mike H" wrote:

Hi,

Try this

=SUM(INDIRECT("A1:A" & A7))

Mike

"Art" wrote:

Column A contains these five numbers: 9,2,3,5,8
Cell A7 contains the number 4

I need a formula that does the following:
Sum the numbers in column A up to the number of rows in A7.

Formula evaluates to 19 (9+2+3+5)

Thanks,
--
Art

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Return a range based on a variable

Art,

=SUM(INDIRECT("A1:A" & A7))

INDIRECT treats the bit in quotes as text and then concatenates the value it
finds in A7 to build a valid Excel formula so say A7 contains the number 4
the formula evaluates as

=sum(a1:a4)

what you can't do is this

=sum(a1:a & a7)
you have to use indirect.

Mike

"Art" wrote:

Mike, works perfectly.
Would you (or anyone smarter than me) explain how the formula works?
--
Art


"Mike H" wrote:

Hi,

Try this

=SUM(INDIRECT("A1:A" & A7))

Mike

"Art" wrote:

Column A contains these five numbers: 9,2,3,5,8
Cell A7 contains the number 4

I need a formula that does the following:
Sum the numbers in column A up to the number of rows in A7.

Formula evaluates to 19 (9+2+3+5)

Thanks,
--
Art

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default Return a range based on a variable

=SUM(A1:INDEX(A1:A5,A7))


"Art" wrote:

Column A contains these five numbers: 9,2,3,5,8
Cell A7 contains the number 4

I need a formula that does the following:
Sum the numbers in column A up to the number of rows in A7.

Formula evaluates to 19 (9+2+3+5)

Thanks,
--
Art

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
Formula based on variable range BruceM via OfficeKB.com Excel Worksheet Functions 3 November 17th 09 07:45 PM
Return actual range not cell value in variable Richhall[_2_] Excel Worksheet Functions 1 September 18th 09 02:34 PM
Deleting a range of rows based on a variable; syntax error Babymech Excel Discussion (Misc queries) 3 January 16th 09 06:19 PM
Return a value if variable is in a range plally Excel Discussion (Misc queries) 3 October 23rd 08 08:27 PM
dynamic summed range based on a variable Bruce Excel Worksheet Functions 3 November 8th 05 02:45 AM


All times are GMT +1. The time now is 08:58 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"