Sold at month 23, and two months short cost more than the whole kitchen
I'll lay this out step by step in case someone else is where I was.
I bought a small 1,100 square foot house last year, 189k, needing a kitchen, a bathroom, floors, and paint. Moved in. Did the work over about a year and a half, mostly myself with a friend who does tile. Total spend on the work, 34k. Sold for 279k. Closing and commission about 17k, so I was up around 39k on paper and I was thrilled.
Here is what I got wrong. I understood the two-of-five-years rule as living there two years. I did not understand that ownership and use are both measured against the closing dates, and I had counted from the day I moved in, which was about ten weeks after I closed because the seller had a rent-back. Then I got an offer I liked in a hot week and I closed the sale at what I thought was month 24 of living there. Against my purchase closing date it was month 23 and a bit.
My CPA told me after the fact. The gain didn't qualify for the full exclusion the way I had assumed, and I ended up owing tax on it. I'm not going to put the exact number here because my situation has other things in it, but it was well into five figures and it was more than my entire kitchen cost. There are partial exclusions in some circumstances tied to specific reasons for moving, and mine didn't fit any of them, which I also learned after the fact.
The worst part is that the buyer would probably have taken a closing date eight weeks later. I never asked, because I didn't know I needed to.
What I'd do differently: write the earliest qualifying sale closing date on a piece of paper the day I close on the purchase, calculated with a CPA and not by me counting on a calendar, and treat it as a hard floor on any offer I accept.