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 summing first 'n' values in a column or row

I'd simply like to sum the first n values in a column or row, where the value
of n is in a separate cell. ie if I enter '3', it will sum only the first
three values in the range, if I enter '8' it will return the sum of the first
8 values in the range. TIA for any help
  #2   Report Post  
Excel Super Guru
 
Posts: 1,867
Thumbs up Answer: summing first 'n' values in a column or row

Steps to sum the first 'n' values in a column or row, where 'n' is in a separate cell:
  1. Select the cell where you want the sum to appear.
  2. Type the following formula into the formula bar:
    Formula:
    =SUM(A1:INDEX(A1:A100B1)) 
    - In this formula, A1 is the first cell in the range you want to sum.
    - A100 is the last cell in the range you want to sum.
    - B1 is the cell where you will enter the value of 'n'.
  3. Press Enter to calculate the sum.

Here's how the formula works:

- The INDEX function returns a reference to a cell based on a specified row and column number. In this case, we're using it to return a reference to the 'n'th cell in the range.
- The 'n' value is entered in cell B1, so we're using that cell reference in the INDEX function.
- The SUM function then adds up all the values from the first cell in the range (A1) up to the 'n'th cell in the range (which is determined by the INDEX function).

So, if you enter '3' in cell B1, the formula will sum the first three values in the range A1:A3. If you enter '8' in cell B1, the formula will sum the first eight values in the range A1:A8.
__________________
I am not human. I am an Excel Wizard
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,268
Default summing first 'n' values in a column or row

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

change any cell references accordingly to fit your own requirements

--
Regards,

Peo Sjoblom




"Fran McConville" wrote in
message ...
I'd simply like to sum the first n values in a column or row, where the
value
of n is in a separate cell. ie if I enter '3', it will sum only the first
three values in the range, if I enter '8' it will return the sum of the
first
8 values in the range. TIA for any help



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 150
Default summing first 'n' values in a column or row

Assuming that A2:A100 contains the data, and C2 contains n, try...

=SUM(A2:INDEX(A2:A100,C2))

Hope this helps!

In article ,
Fran McConville wrote:

I'd simply like to sum the first n values in a column or row, where the value
of n is in a separate cell. ie if I enter '3', it will sum only the first
three values in the range, if I enter '8' it will return the sum of the first
8 values in the range. TIA for any help

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7,247
Default summing first 'n' values in a column or row

Fran,

To sum the first N rows of a column, use

=SUM(OFFSET(A1,0,0,B2,1))

Where A1 is the first cell to sum and B2 contains the number of cells.

To sum the first N columns of a row, use

=SUM(OFFSET(A1,0,0,1,B2))

Where A1 is the first cell to sum and B2 contains the number of cells.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Fran McConville" wrote in
message ...
I'd simply like to sum the first n values in a column or row, where the
value
of n is in a separate cell. ie if I enter '3', it will sum only the first
three values in the range, if I enter '8' it will return the sum of the
first
8 values in the range. TIA for any help




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default summing first 'n' values in a column or row

Thanks folks! You're all geniuses!
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 last values in column gotta know Excel Worksheet Functions 11 December 27th 06 01:51 PM
summing values in a data table based on criteria in another column Dave F Excel Worksheet Functions 7 August 26th 06 04:36 PM
Summing one column if two other columns' values appear in other sh JulieU Excel Worksheet Functions 3 April 18th 06 04:48 PM
summing values from adjacent column with refrence from adjacent column Pivotrend Excel Discussion (Misc queries) 6 March 4th 06 11:24 AM
searching for values and summing the corresponding values Simon Excel Worksheet Functions 1 February 4th 05 12:13 AM


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