Basic Standard Deviation Calculation

Hi, it's been a while since I've attempted any statistics a just wondering if you could check that I'm using the right method to calculate the standard deviation.

We're given than the mean, $\displaystyle \bar{x} = 8.35$, $\displaystyle \Sigma x = 334$ and $\displaystyle \Sigma x^2 = 3002$ with a sample size of 40.

I used the formula $\displaystyle \sigma =\sqrt{\Sigma (x^2) - \bar{x}^2}$.

Is this the correct formula to use or have I gone wrong somewhere?

Thanks