There are many ways to get the last column. i.e. you could use an array formula to return the column index if the the cells aren't empty then get the maximum. Once you have the column index you could get the column by using OFFSET among other functions.
This formula returns the column index of the last column having values on row 1.
=ARRAYFORMULA(MAX(IF(ISBLANK(1:1),,COLUMN(1:1))))
Let say that the above formula is in A2, then the following formula returns the values of the first ten cells of the last column having values.
=OFFSET(A1,0,A2-1,10)
Let say that the above formula in in A3, then just apply
=SUM(A3:A13)
You could put all in a single formula, but first, be sure that each part work properly as it will be easier to fix each part if they are separate.