In our text book, the formula for finding the formal charge of an element in a compound is

c(sub f) = X - (Y + Z/2)
where x = the number of valence electrons
y= the number of unshared electrons owned by the atom
z= the number of bonding electrons shared by the atom.

would this formula work if you were trying to find the formal charge of oxygen in SO2, where there are more than one oxygens?

First you must draw the Lewis electron dot structure for the molecule before you will know how many of an atom's electrons are shared and how many are not. With regard to SO2, specifically, the formal charge on one of the O atoms is 0 and the formal charge on the other O atom is -1. The formula works for both but it must be applied to each oxygen atom separately. I learn something every day. I didn't know there WAS a formula for determining formal charge. I've just counted the electrons around an atom and compared that with the normal number