tags:

views:

134

answers:

4

Can I sum these numbers with a formula ?

1
2
3
4
5
6

No, Im not looking for ="Sum(Cell___1:Cell_6)".
With "Product" you multiply - I just want to add them. Like "=1+2+3+4+5+6", but just with a formula. Eg "formulaName(6)".

+12  A: 

You mean:

Sum = n * (n+1) / 2, where n is the last number in the sequence?

BobbyShaftoe
For the historically interested: Finding this formula is attributed to the German mathematician Karl Friedrich Gauss (1777-1885). In his elementary school the teacher tasked the class to to sum up all numbers from 1 to 100 (hoping he could take a nap in the meantime), Gauss came up with this formula and the correct answer after a couple of seconds.
Tomalak
@Tomalak, yeah Elementary Proofs professor told me that story too. :)
BobbyShaftoe
Cant believe I had forgotten all about it. Thanks
Kim
Which is the same as (n^2+n)/2...I've used this ever since high school, didn't know someone else came up with it. I figured it out for a piece of math coursework. It never crossed my mind to factor it out.
BenAlabaster
+1  A: 

Well... =6*(6+1)/2 ought to do it

For a more general approach, you could put 6 into, say, A1, and use

=A1*(A1+1)/2

Carl Manaster
A: 
Function GaussForm(ByVal x As Integer) As Integer

       GaussForm = (x * (x + 1) / 2)

End Function
NickSentowski
A: 

Not very Gaussian, but here's another way:

=SUM(ROW(A1:A6))

It's an array formula, so enter with Control+Shift+Enter

Dick Kusleika