0

I need a formula that will take a number in a cell, and then add that number to itself -1, until itself -1 = 0. For example, if the number were 5, the formula would be:

5 + 4 + 3 + 2 + 1

I could do this pretty easily in a for loop, but I hoping to avoid messing with sheets scripting.

1

I figured it out. Assuming the number in question is 38 minus whatever is in cell B15, the following formula works perfectly:

=((38-$B15)*$B15) + ((38-$B15) * (38-$B15)/2) - (38-$B15)/2

0

=ArrayFormula(SUM(ROW(INDIRECT("1:"&B1))))

...assuming the start number is in B1.

Essentially, this creates a reference to a range with as many rows as your start number, then uses SUM to add the row number property of each row.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.