View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Using Sum function dynamically

Hi David,

Am Fri, 3 Nov 2017 10:31:50 -0700 (PDT) schrieb
:

I am trying to figure out how to adjust the range of cells which are summed based on the value within another cell.

so if I had =sum(a1:f1) but I wanted to have the start and end points be dynamic from a column perspective (the row would remain constant). So based on the value of cell a10 and b10, for instance, the starting and ending column position might change to be B1 and E1 or some subset or expansion of A1:F1.


what values are in A10 and B10?

If there is e.g. B and G then use:
=SUM(INDIRECT(A10&"1:"&B10&"1"))

If you want to copy down the formula you better try:
=SUM(INDIRECT($A$10&ROW(A1)&":"&$B$10&ROW(A1)))


Regards
Claus B.
--
Windows10
Office 2016