Investors & landlords

If the house is sold within 3 years after you move out, yes, it will qualify for AN exclusion.  But NOT the full exclusion.  In your case, you will have TWO things to prorate.

One is of the maximum amount.  So you would qualify to exclude up to 18/24ths of $250,000 ($500,000 if Married Filing Jointly).  That is the situation of the original question on this thread.

But in your case, it is also prorated based on "Nonqualified Use".  To keep it simple and not get bogged down into the details, let's say (a) you owned it for 15 years, (b) it was you main home for 7 of those years, and (c) it was rented for 3 years AFTER you moved out for the LAST time, then you can only exclude 10/15ths of the gain (not including depreciation).  The 5 rental years BEFORE it was your Main Home this last 18 months can NOT be excluded.

So in that scenario, you would pay tax on 5/15ths of the gain, PLUS the depreciation.