The Rules for Writing Formulas for Ionic Compounds When metal and nonmetal ions form ionic bonds, their total electrical charges must balance each other exactly (as in, add up to zero). In order to write a correct formula, you must know the ion charges of all the