ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Adding rows based on no of rows specified from a given position (https://www.excelbanter.com/excel-worksheet-functions/194221-adding-rows-based-no-rows-specified-given-position.html)

Nanette

Adding rows based on no of rows specified from a given position
 
hi there.

how can i add the contents of the rows given the number of rows to add?

i.e.
a1 = 1
a2 = 2
a3 = 3
a4 = 4
a5 = 5

if b1 = no of rows to add = 3
then c1 = ? formula to sum up a1:a3 = 6

if b2 = no of rows to add = 2
then c2 = ? formula to sum up a4:a5 = 9

thanks very much.



Pete_UK

Adding rows based on no of rows specified from a given position
 
You can do that like this in C1:

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

and this one in C2:

=SUM(INDIRECT("A"&B1+1&":A"&B1+B2))

Hope this helps.

Pete

"nanette" wrote in message
...
hi there.

how can i add the contents of the rows given the number of rows to add?

i.e.
a1 = 1
a2 = 2
a3 = 3
a4 = 4
a5 = 5

if b1 = no of rows to add = 3
then c1 = ? formula to sum up a1:a3 = 6

if b2 = no of rows to add = 2
then c2 = ? formula to sum up a4:a5 = 9

thanks very much.






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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com