Chemical analysis involves either laboratory “test-tube” reactions or instrumental methods. Test-tube reactions look for either positive ions or negative ions. If you want to analyse a salt, look at the two ions separately so for magnesium nitrate, look to prove it contains magnesium ions and then look to prove it contains nitrate ions. Check on the data sheet to make sure you give the correct charges on the ions. If the charges on the ions are correct, you can then get the formula correct too.