Why is a sodium chloride molecule stable? The ionization energy of sodium is $\pu{5.139eV}$. This is the energy absorbed when a neutral sodium atom is stripped of its outermost electron. The electron affinity of chlorine is $\pu{3.62eV}$. This is the energy released when an electron is added to a neutral chlorine atom to form the chlorine anion.
Now suppose we have a system containing exactly one neutral sodium atom and exactly one neutral chlorine atom infinitely far apart so that the systems potential energy is zero. If we wish to make a $\ce{NaCl}$ molecule from our system, we need to put $\pu{45.139eV}$ of energy into the system to ionize the sodium atom. Afterwards, we place the electron we have just pulled off the sodium atom onto the chlorine atom upon which we get back only $\pu{3.62eV}$ of energy. So the total energy of the system has increased by $\Delta E =\pu{5.139eV -3.62eV= 1.519eV}$.
If the total energy of the system has increased after performing the previous supposition, then why does the $\ce{NaCl}$ ionic bond occur? Surely it is less stable than having the two neutral atoms separate from each other? My understanding up till now has been that molecules form when the total energy of the system is lower than the total energy of the sum of its constituents?
Is this all because an individual $\ce{NaCl}$ bond is not stable on its own but it is stable when its within a crystal lattice?
Any help on this issue would be most appreciated!
What you have calculated is the energy required to make two separated ions out of two separated $\ce{Na}$ ad $\ce{Cl}$ atoms. When they are separated, these ions do not make a molecule or a crystal of salt. Separated ions attract one another and are able to release a huge amount of Coulomb energy when approaching each other.
Anyhow your calculation should still take into account the fact that chlorine atoms do not actually exist. They must be produced by breaking a $\ce{Cl2}$ molecule. And this requires some energy. You may also introduce the sublimation energy of sodium atoms