Name a cell N, and enter 24 into it. Define another name S as the
formula
=ROW(INDEX($1:$65536,1,1):INDEX($1:$65536,N,1))
Use it in a formula like
=SUMPRODUCT(INDEX(C3:C1000,999-N):C1000,S)
This returns a weighted sum of the last N (24 per the example) values
in C3:C1000.
Dynamic ranges are more commonly used than dynamic arrays, but the
intent of both is to allow the model to change the size and sometimes
the shape of ranges or arrays used in formulas.