Carl
Level 15

Investors & landlords

You get the full exclusion if you lived in the property for at least 730 days (2 years) of the last 1826 days (5 years) you owned it. Days in the suspension period are not counted for the 1826 days of ownership. The suspension period can work out to be any period of time, up to a maximum of 10 years. So lets count back the days from the closing date of the sale. The closing date of the sale is not counted as one your days of ownership. Now with my below I"m going to pick dates out of thin air, in the tax year that applies, since you didn't provide exact dates for me to work with. The specific dates I select also make the math easier on my end. But clear your head anyway, check the air tanks and make sure the regular valve is working correctly. We're going deep.

Date you moved out of the property and departed the area: 7/1/2010
Date you returned to the area and did not move back in : 7/1/2018.
Closing date of sale: 7/1/2020.
First, we have to determine the start date of your days of ownership that applies, and not include in that day count, the days that are excluded.
So the day count from 7/1/2020 back to 7/1/2018 is 731 days (2020 was a leap year)
Continuing the count backwards, and the days from 7/1/2018 back to 7/1/2010 are excluded from being counted as "days of ownership", because those days are the days you were not living in the property because of official orders.
The day count resumes the count backwards in time on 6/30/2010. We can go back from this date a maximum of 1,095 days. That takes us to 7/1/2007.
So your "days of ownership" for determining if you qualify for any exclusion runs from 7/1/2007 to 6/3/2008. Then it resumes on 7/1/2018 up to the date of the closing on the sale. That gives a total of 1826 days (5 years) Here's the math.
7/1/2007 to 6/30/2010 is 1095 days
7/1/2009 to 6/30/2018 are not counted
7/1/2018 to 7/1/2020 is 731 days
Total days is 1826, which equates to 5 years.
Days you lived in the property as your primary residence between 7/1/2007 and 6/30/2010 is 1095 days, of the 730 days required for full exclusion.
Days you lived in the property as your primary residence between 7/1/2018 and the closing date of 7/1/2020 is 0 days.
You have a total of 1095 days out of the 730 days required for the maximum exclusion. You qualify to exclude the total gain up to a maximum of $250,000 if single, and a maximum of $500,000 and married filing joint and *BOTH* you and your spouse lived in the property as your primary residence during the days within the periods of qualifying time.
Finally, remember that you "will" pay taxes on the depreciation you're required to recapture, no matter what. The depreciation recapture is not included in whatever amount of the gain you are allowed to exclude.