have lived there for 2 out of 5 years before the sale. That means, if you have lived in the townhouse for 2 years, then if you sell it within 3 years, you qualify for the tax benefit.