The yield of excited atoms in a beam formed by charge exchange in a partially ionized gas target