NOT a tax advice, ask your CPA for clarification. When you rent your house, every year you can claim certain amount as depreciation expense. If you sell you house before your house is fully depreciated, you need to pay tax on all the deduction you took (the amount you claimed every year as depreciation).
For 7 years, yes as long as minimum of 2 years, still 500K (if married), there is no maximum.
In this case, you can use the 500k homeowner exemption on the appreciation (lets say appreciation is 700k total) and since you rented out for 2 years (makes this investment property) you can avoid paying tax on 200k by doing a 1031 exchange. The new property should be cost more than what you are selling.