But nothing will protect you if you simply don't follow the rules. If you are forced to sell because employer moved you to another city, you can have part of the exclusion. Each of the 3 tests involves a 2-year period. Simply find the one in which you have the least time. That determines your percentage.
Timing is Everything.
The rules are simple. Any sale must be planned carefully before you do a thing. Once the title is transferred, the deal is done. Also, lenders and other private parties may require you to produce copies of your tax returns as a condition to lending money or approving a purchase. It is a good rule of thumb to always keep all returns indefinitely.