It appears that you should qualify for this exemption, provided you haven't taken it for another property during the same time period. If you were to purchase another home immediately after selling this one (and taking the exemption for this one), lived in it for two years, then sold it immediately, you would also qualify to take an exemption for that new home.
What counts is that you used the home as your primary residence for two of the past five years. I outlined another unusual example in an answer to another question by Trulia. You can see that example here: http://www.trulia.com/voices/Home_Buying/How_does_the_two_ye
IRS Publication 523, available from the IRS website at http://www.irs.gov/taxtopics/tc701.html, contains eligibility requirements for this deduction. In general, the IRS site has a lot of useful and plain-English information about how tax law applies to real estate. Take a look!
Don Pasek, CIPS, TRC, ADPR
Omniterra Real Properties
+1 (773) 763-7000
Otherwise it is 2 out of 5 consecutive years also to qualify. So after the fist 2 consecutive years living there you could rent it out for the next 3 yrs and if you sell (close) before the 5 consecutive years is up, you also qualify. I have done this in the past. You are lucky if you will have a profit, after all your closing costs both on the buy and sell side.