Say you have number 1,2,3,4,5,6, in cell A1,A2,A3,A4,A5,A6 respectively. in cell A7 we calculate the sum of A1:Ax. x is specified in cell B1 (in this case, x can be any number from 1 to 6). in cell A7, you can write the following formular:
=SUM(A1:INDIRECT(CONCATENATE("A",B1)))
CONCATENATE will give you the index of the cell Ax(if you put 3 in B1, CONCATENATE("A",B1)) gives A3).
INDIRECT convert "A3" to a index.
see this link Using the value in a cell as a cell reference in a formula?