@Reg_Slayer – oh, yes, that stuff is tough. I really struggled with it. I don't know if you noticed it yet in everything @sonja90 posted, but she has good steps. I used the same steps for every basis problem to make sure I didn't miss anything, and they work well.
1. Determine realized gain.
Realized gain = Amount realized – old stuff basis
Amount realized = New item FMV + boot received (including cancellation of debt) – boot given <- remember, this is amount realized, you still need to subtract old basis to get realized gain
I like to think of realized gain as: (everything you get, including ALL boot) – old basis
2. Determine recognized gain.
Pick the lesser of net boot received or realized gain. If net boot received is $0 (maybe because net boot is given), then recognized gain is $0. Loss is never recognized in this type of transaction.
3. Determine deferred gain.
Deferred gain = realized gain – recognized gain
If it's negative, you have a deferred loss, that's okay, it happens.
4. Calculate new basis. There are two ways to do this.
a. New basis = new FMV – deferred gain + deferred loss
b. New basis = old basis – boot rcvd + boot paid + gain recognized
Hope it helps! If not, maybe someone else will post another way to do it. Sometimes you just need to think about it in a slightly different way and then it makes more sense.