Google-sheets – Formula that will take a number in a cell, and then add that number to itself -1, until itself -1 = 0

formulasgoogle sheets

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.

Best Answer

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