I have a range like in the following image:
Where the top headers represent the months of the year (1-12) and the left column represents the days in a month (1 to 28/29/30/31).
I would like to perform a SUM function over the last 30 days of my range such that it starts counting from the last non-empty value and goes up until it reaches the first value of that column, and then if there are still days to count, goes to the previous month and starts counting from its last value.
For example, in the image if I wanted the sum of the values of the last 6 cells of the range, it would sum up 16, 12, 8, 4, 4 and 15.
I've tried adapting the solution to a similar problem as outlined here, but I haven't been able to make it work so far.