Let's say I wanted to take a sum of a range of cells. I want that range to be variable, based on other cell values. Specifically, I'm concerned with controlling the number of columns, and the 1st column will always be the same.

For example:
Cell A1 = 4, the number of columns to sum

Random numbers to sum:
A2 = 1
A3 = 1
B2 = 2
B3 = 2
C2 = 3
C3 = 3
D2 = 4
D3 = 4

What is the formula to take sum of the data based on the number of columns?

If
A1 = 4, sum(A2:D3)
A1 = 3, sum (A2:C3)
etc.

For my current project, I am only focusing on columns, but I can see how using this type of reference would have many other uses. Thanks!