An ionic compound is formed from the exchange of cations or anions of the participating elements or compounds in the reaction. The formation can be due to the reactions like single displacement or double displacement reactions. The final product has atoms with subscripts that are from the exchange of charges.