How to calculate the formal charge of sulfate ion?

I found a site with this formula if you will,

Formal Charge = [Number of valence electrons on atom] – [non-bonded electrons + number of bonds]

I don't think I am using it correctly in finding the formal charges of each atom in $\ce{SO_4^{2-}}$. $\ce{S}=2$, $\ce{O}=-1$ and the other $\ce{O}=0$ and if you add them together I don't get the overall charge of -2.
How do you work out formal charges?

Your formula is correct. If $V$ is the number of valence electrons originally assigned to an atom, $N$ is the number of nonbonding electrons, and $B$ is the number of bonds ($\frac{1}{2}$ of the number of bonding electrons to be more precise), then the formal charge $FC$ is:

$$FC = V - (B+N)$$

Sulfate ion has two valid structures that you could draw, one with sulfur having a formal charge of zero and one with sulfur having a formal charge of +2. The structures below (from the Wikipedia page, released into the public domain) follow the annoying but allowable convention of replacing lone pairs with bars. If the structure on the left (#1) is correct, then the sulfur atom ($V=6$) has six bonds ($B=6$) and no lone pairs ($N=0$). Two oxygen atoms (V=6) have two bonds ($B=2$) and two lone pairs ($N=4$), while the other two oxygen atoms have one bond ($B=1$) and three lone pairs ($N=6$). The sulfur atom and two oxygen atoms have $FC=0$ and the remaining two oxygen atoms have $FC=-1$ for an overall charge on the ion of $-2$.

$$FC_{\ce{S}}=6-(6+0)=0$$ $$FC_{\ce{O_{1,2}}}=6-(2+4)=0$$ $$FC_{\ce{O_{3,4}}}=6-(1+6)=-1$$

If the structure on the right (#2) is correct, then the sulfur atom ($V=6$) has four bonds ($B=4$) and no lone pairs ($N=0$). All four oxygen atoms (V=6) have one bond ($B=1$) and three lone pairs ($N=6$). The sulfur atom has $FC=+2$ and the oxygen atoms have $FC=-1$ for an overall charge on the ion of $-2$. $$FC_{\ce{S}}=6-(4+0)=+2$$ $$FC_{\ce{O}}=6-(1+6)=-1$$

But, wait! A more fundamental question might be "How can the sulfate ion have two very different structures that puts different formal charges on the sulfur and oxygen atoms?"

Formal charge is a nice bookkeeping mechanism, but has no experimentally valid relationship to the actual charge on any atom in most molecules or ions. Formal charge only equals actual charge on monoatomic species. Formal charge falls into the category of models that we use in chemistry that are 1) helpful, 2) produce the correct answer when used correctly, and 3) completely bogus. Other models in this category include oxidation number, VSEPR, resonance, and electronegativity. The experimental evidence suggests the real structure of sulfate combines features of both structure #1 and structure #2, but would be challenging to draw using the formalisms we have adopted:

• All four $\ce{S-O}$ bonds are equal in length (#2).
• The length of the $\ce{S-O}$ bonds is shorter than a normal $\ce{S-O}$ single bond and longer than a normal $\ce{S-O}$ double (#1).
• The sulfur atom has a partial positive charge (#2) (note that partial charges, unlike formal charges, have some experimental basis).
• The four oxygen atoms have equivalent partial negative charges (#2).
• The partial negative charges on the oxygen atoms add to more than $-2$ but not anywhere near $-4$ (#1).

Ben Norris' answer is excellent. I'll collaborate with a more visual procedure, so it may provide a different point of view.

The way I've learned it, oxidation numbers can be determined by figuring out where the bonding electrons would be assuming bonds are 100% ionic, while formal charges can be determined by figuring out where the electrons would be if the bond were 100% covalent.

Instead of applying an equation directly, draw the Lewis structure of the compound. Now cut all covalent bonds homolytically, i.e. evenly distributing the two electrons between the bonding atoms. Now count the number of electrons attached to each atom, and subtract the number of valence electrons the free atom has. The number you obtain will be an "electron excess", which is the opposite of the formal charge, so just multiply by -1. Here's your example worked out. 