Don't over complicate it.
Gain is more or less what you sold if for minus what you have spent on it. If you sold it for $500k and bought it for $200k, you have a $300k gain. There are a couple of tweaks to this, but let's keep it simple.
If you/wife owned and lived in the house for 2 out of the last 5 years, you can each exempt $250k of gain.
So using the example of $300k of gain above, that is $150k allocated to each of you. If you can exempt up to $250k, then you essentially have no taxable gain.
You have $300k in actual gain but no taxable gain. If you have no taxable gain, you don't even have to report it.
Looking back to the IRS language. If you sold your main home, do not report it on your return unless you cannot exclude all of your gain (i.e. via the $250k exemption). Said another way, report it if you have taxable gain (after you have considered the $250k exemption).