View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Variable reference to add cells

If I understand your question correctly this should be close...

=SUM(A1:A2)-SUM(A4:INDEX(4:4, 1, A5+1))
--
HTH...

Jim Thomlinson


"Nick Savage" wrote:

I want to use a variable to add a number of cell values together:

in the example below cell 'e3' needs to be the sum of cells a1:a2 less the
sum of cells a4:e5 but I need to use the value of cell 'a5' to 'go back' 4
columns so that I can vary the number of columns to count back by changing
the value of a5.

a b c d e
1 10

2 20

3

4 2 2 4 2 2

5 4

Thanks