#### Answer

$\frac{-1\pm\sqrt{1+8S}}{2}$

#### Work Step by Step

First we cross-multiply:
$S= \displaystyle \frac{n(n+1)}{2}$
$2S=n^{2}+n$
$n^{2}+n-2S=0$
Now we use the quadratic formula:
$n=\displaystyle \frac{-1\pm\sqrt{(1)^{2}-4(1)(-2S)}}{2(1)}=\frac{-1\pm\sqrt{1+8S}}{2}$