In chemistry, a compound's valence number is the number of bonds formed by the electrons in the last (outer) shell (called valence electrons) of atoms to other atoms' valence electrons. The octet rule (the tendency of an atom to seek stability by filling its outer shell with eight electrons by forming valence electron bonds) can help you determine the valence of a compound once you know the maximum possible valence bonds each element can form.
Decipher which elements are present in your compound and how many molecules of each element by looking at the abbreviation in the compound name. For example, NaCl has two elements with one molecule of each element, Na (sodium) and Cl (Chlorine), and CaCl2 has two elements with one Ca (Calcium) molecule and two Cl (Chlorine) molecules.
Determine the number of valence electrons of each element by looking at the the oxidation number column of the chart in the resources section. Some elements have multiple oxidation numbers because there are a number of possible bond combinations between various elements. Use your judgment to determine which number is the correct number for your compound by trying to balance the total charge of each element with the other so that the negative and positive values have a sum of zero. For example, in the compound SO3, Oxygen can have -1 or -2 valence values, and S can have -1, -2, +2, +4 or +6 values but since there are three Oxygen molecules and one Sulfur molecule, each Oxygen molecule must have a value of -2 (total of -6) and each Sulfur molecule a value of +6 to balance to zero (-6 +6 = 0).
Count the number of bonds necessary to get that zero sum value. You can do this by counting the largest number of valence electrons to be paired (in the previous example, the largest absolutely value was 6).