Lattice Energy can't be measured directly: no one can pull a crystal apart into gaseous ions in a calorimeter. But Hess's Law, together with ionization energies, lets us build the crystal from its elements by a route of measurable steps and find it by subtraction.
Key idea
The Born–Haber cycle for NaCl: $$\Delta H^\circ_\text{f}[\mathrm{NaCl}] = \underbrace{\Delta H_\text{sub}(\mathrm{Na})}_{\text{solid to gas}} + \underbrace{\tfrac{1}{2}D(\mathrm{Cl{-}Cl})}_{\text{half a bond}} + \underbrace{IE_1(\mathrm{Na})}_{\text{make Na}^+} + \underbrace{EA(\mathrm{Cl})}_{\text{make Cl}^-} - U$$ where $U$ is the lattice energy (energy to separate the solid into ions) and $EA$ is the (negative) enthalpy change for adding an electron to a gaseous atom. Solve for $U$.
Why it works
Two routes lead from Na(s) and $\tfrac{1}{2}\mathrm{Cl_2(g)}$ to NaCl(s): the direct one, $\Delta H^\circ_\text{f}$, and the long way around: vaporize the sodium, break half a mole of Cl–Cl bonds (we need only one mole of Cl atoms), remove an electron from each Na atom, give it to each Cl atom, and let the gaseous ions collapse into the crystal ($-U$). Enthalpy is a state function, so both routes have the same total. Every step except the last can be measured, so the last is found by subtraction.
Worked example: Sodium chloride
Find the lattice energy of NaCl from: $\Delta H_\text{sub}(\mathrm{Na}) = 107.5$, $\tfrac{1}{2}D(\mathrm{Cl_2}) = 121.3$, $IE_1(\mathrm{Na}) = 495.8$, $EA(\mathrm{Cl}) = -348.6$ and $\Delta H^\circ_\text{f}(\mathrm{NaCl}) = -411.2$ (all kJ/mol).
- Steps before the lattice: $107.5 + 121.3 + 495.8 - 348.6 = 376.0\ \text{kJ}$ (the gaseous ions sit 376.0 kJ above the elements).
- $-411.2 = 376.0 - U$, so $U = 376.0 + 411.2 = 787.2\ \text{kJ/mol}$.
Answer: $787.2\ \text{kJ/mol}$
Worked example: Magnesium chloride
Find the lattice energy of $\mathrm{MgCl_2}$ from: $\Delta H_\text{sub}(\mathrm{Mg}) = 147.1$, $IE_1 = 737.7$, $IE_2 = 1450.7$, $D(\mathrm{Cl_2}) = 242.6$ (the whole mole of bonds, since we need 2 Cl), $EA(\mathrm{Cl}) = -348.6$ per Cl, and $\Delta H^\circ_\text{f}(\mathrm{MgCl_2}) = -641.3$ (kJ/mol).
- Mg needs both ionization energies to become $\mathrm{Mg^{2+}}$: $737.7 + 1450.7 = 2188.4$.
- Two Cl atoms: $242.6$ to make them, $2(-348.6) = -697.2$ to give each an electron.
- Before the lattice: $147.1 + 2188.4 + 242.6 - 697.2 = 1880.9\ \text{kJ}$.
- $-641.3 = 1880.9 - U$, so $U = 2522.2\ \text{kJ/mol}$.
Answer: $2522\ \text{kJ/mol}$, more than three times NaCl's, as the 2+ charge predicts.
Common mistake
Using the whole Cl–Cl bond energy when the formula has one Cl (NaCl needs only half a mole of $\mathrm{Cl_2}$), or leaving out the second ionization energy when forming $\mathrm{Mg^{2+}}$. Check: write the cycle with the formula's coefficients: one Cl atom means $\tfrac{1}{2}D$; a 2+ ion means $IE_1 + IE_2$.