Introduction to ionic solid structure
Coordination numbers


CaF2

NaCl

Na2O
The lattice of an ionic compound has both anions and cations.  A portion of the lattice for three ionic solids is shown.
The lattice of an ionic solid is most stable if attractive forces are maximised and repulsive forces are minimised thus
anions are surrounded by cations
cations are surrounded by anions
ions of like charge are separated from one another
 
Because the overall charge on the lattice must be zero, the relative numbers of anions and cations in the lattice depends on the charges on the ions.
For compounds like NaCl where the charges on the ions are equal and opposite, the number of anions equals in the number of cations. 
For compounds CaF2 and Na2O, where the charges on the negative and positive particles are not equal and opposite, the numbers of anions and cations in the lattice are different.

Lattices are infinite repeating structures; therefore we cannot count all of the cations and anions.

Since lattices are regular arrays, every part of the lattice is the same as every other part, and every cation is in the same environment as is every anion.  Therefore if we can count the number of ions of opposite charge that surround one of each of the types of ions, the same number will surround all ions of that type.  This number is known as the coordination number.
 
The coordination number of the cation equals the number of anions it touches.
The coordination number of the anion equals the number of cations it touches.

The ratio of the coordination numbers indicates the ratio of the number of cations to the number of anions in the lattice.