summing first 'n' values in a column or row

  • Thread starter Fran McConville
  • Start date
F

Fran McConville

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
 
P

Peo Sjoblom

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

change any cell references accordingly to fit your own requirements
 
D

Domenic

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

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

Hope this helps!
 
C

Chip Pearson

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top