Zeeman splitting of quantum-confined states of excitons in InGaAs quantum wells (QWs) is experimentally found to depend strongly on quantization energy. Moreover, it changes sign when the quantization energy increases with a decrease in the QW width. In the 87-nm QW, the sign change is observed for the excited quantum-confined states, which are above the ground state only by a few meV. A two-step approach for the numerical solution of the two-particle Schrodinger equation, taking into account the Coulomb interaction and valence-band coupling, is used for a theoretical justification of the observed phenomenon. The calculated variation of the g-factor convincingly follows the dependencies obtained in the experiments.