An ionic compound is not made of separate molecules. Its positive and negative ions are packed together in a regular arrangement called a lattice. In sodium chloride, for example, each sodium ion is surrounded by six chloride ions, and each chloride ion is surrounded by six sodium ions.
The ions are held in place by strong electrostatic forces of attraction between oppositely charged ions. These forces are called ionic bonds. They act in all directions throughout the lattice, so the whole structure is held together as one giant arrangement.
Because the lattice goes on and on, the formula of an ionic compound does not show a molecule. The formula NaCl shows the ratio of sodium ions to chloride ions, which is 1 to 1.