How can I calculate the sum of all positive integers less than n? [closed]
- by Adrian Godong
I have the following function:
f(n) = f(n - 1) + (n - 1)
f(0) = 0
n >= 0
I have n declared on column A, and need the result of f(n) on column B.
I'm trying to find the Excel formula equivalent for this function.
Sample Result:
A | B
--+--
0 | 0
or:
A | B
--+--
1 | 0
or:
A | B
--+--
4 | 6
but never:
A | B
--+--
0 | 0
1 | 0
2 | 1
...
The biggest problem is, I can't simulate the value of f(n - 1). So referencing the previous row like the above example is invalid. I'm almost sure the answer is trivial, I just can't find it.