Looking for a formula that will change the cell range dynamically based on a variable in another cell.

For Example: I have numbers 1 - 10 in A1:A10

@ c4 =sum(A1:A4)

@ e10 = 4

If I change the number in E10 from 4 to 7, then at C4 the sum should automatically change to sum(A1:A7)

-Balki