Deductions & credits

to be eligible for the full $250K exclusion you must own the property for any 2 out of 5 years before the sale. you must occupy it as your principal residence for any 2 out of 5 years before the sale. that you don't live on the property at the date of sale is irrelevant as long as you meet those two tests.

 

based on what you provided you could wait until the end of 2023 to sell and still get the full exclusion

5 years  - 1/1/19-12/31/23 bought in 2017 so you meet the ownership test since you owned it for 2 years during the period 2019-2023. the same goes for the occupancy test. the 2 years 2019 and 2020