Hello this can be done in multiple ways, i m using Excel 2021:
using offset as you already have tried:
=SUM(OFFSET(A2,0,0,C1,1))
using index with row and indirect functions:
=SUM(INDEX(A2:A6,ROW(INDIRECT("1:"&C1))))
index and sequence - formula in A1:
=SUM(INDEX(A2:A6,SEQUENCE(C1)))
Hope it helps.