To determine the last column, one should decide in what row to measure it. Suppose it's the 2nd row; then the last column number is
where I put K to avoid circular dependency, since this formula will also affect some cells in row 2, to the left of column K. I'd put the above formula in some cell, e.g., E1 (or on another sheet), and then use it in computations like this:
=arrayformula(filter(K2:27, column(K2:2)=E1) - filter(K2:27, column(K2:2)=E1-1))
This takes the difference between the last and second-to-last columns.
filter, one could incorporate column number in formulas by using
indirect with R1C1 notation, but that seems more complicated to me.