How to calculate the formal charge of sulfate ion?
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).