![]() |
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 |
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:
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. |
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 |
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 |
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 |
summing first 'n' values in a column or row
Thanks folks! You're all geniuses!
|
All times are GMT +1. The time now is 06:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com