View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
RagDyeR RagDyeR is offline
external usenet poster
 
Posts: 3,572
Default Sum over a variable number of cells

To sum Row 2, starting at A2, and user enters the number of columns to total
into A1:

=SUM(A2:INDEX(2:2,A1))

If A1 is empty, entire row will total.

To sum Column B, starting at B1, and user enters the number of rows to total
into A1:

=SUM(B1:INDEX(B:B,A1))
Same holds true if A1 is empty.

To allow user to define both start and end points, entering boundaries in
say A1 and A2 for Column B:

=SUM(INDEX(B:B,A1):INDEX(B:B,A2))

--
HTH,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------


"SD" wrote in message
...
I am building a financial model and would like to sum values over a
variable
number of preceeding cells (the number of cells should be inputted by a
user). How can I implement this functionality?