  The formation of molecular hydrogen (H$_2$) and carbon monoxide (CO) is
sensitive to the volume and column density distribution of the turbulent
interstellar medium. In this paper, we study H$_2$ and CO formation in a large
set of hydrodynamical simulations of periodic boxes with driven supersonic
turbulence, as well as in colliding flows with the \textsc{Flash} code. The
simulations include a non-equilibrium chemistry network, gas self-gravity, and
diffuse radiative transfer. We investigate the spatial resolution required to
obtain a converged H$_2$ and CO mass fraction and formation history. From the
numerical tests we find that H$_2$ converges at a spatial resolution of
$\lesssim0.2$~pc, while the required resolution for CO convergence is $\lesssim
0.04$~pc in gas with solar metallicity which is subject to a solar
neighbourhood interstellar radiation field. We derive two critical conditions
from our numerical results: the simulation has to at least resolve the
densities at which (1) the molecule formation time in each cell in the
computational domain is equal to the dissociation time, and (2) the formation
time is equal to the the typical cell crossing time. For both H$_2$ and CO, the
second criterion is more restrictive. The formulae we derive can be used to
check whether molecule formation is converged in any given simulation.
