adding variable number of columns

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Can you add a variable number of columns?
I have a value in cell A1 which can be a number between 1 and 12.
In cell B1 I want a formula which will give:
If A1 = 1, B1 = A2
If A1 = 2, B1 = A2+B2
If A1 = 3, B1 = A2+B2+C2
If A1 = 4, B1 = A2+B2+C2+D2...etc
is there a way to say B2 = A2 plus n cells in the same row, where n is the
vvalue in cell A1?

thanks for any help you can give!
cheers
 
Can you add a variable number of columns?
I have a value in cell A1 which can be a number between 1 and 12.
In cell B1 I want a formula which will give:
If A1 = 1, B1 = A2
If A1 = 2, B1 = A2+B2
If A1 = 3, B1 = A2+B2+C2
If A1 = 4, B1 = A2+B2+C2+D2...etc
is there a way to say B2 = A2 plus n cells in the same row, where n is
the value in cell A1?


One way:
=SUM(A2:INDIRECT(CHAR(CODE("A")+A1)&2))
 
Back
Top