Welcome to Just Answer,
That is NOT correct.
You may be able to exclude gain from the sale of a home you have used for business or to produce rental income if you meet the ownership and use test.
You just need to live there as a primary residence for 2 years during the five year period ending on the sale of the property.
The situation that you are in is demonstrated in the example on page 15 of the IRS publication 523 (bottom right hand side of the page).
Please let me know if you need further clarification.