Figuring the Gain
If the amount realized is more than the adjusted basis, the difference is a gain and the taxpayer may be able to exclude all or part of it. If the amount realized is less than the adjusted basis, the difference is a nondeductible loss.
Click here to view Worksheet 2 (from Publication 523) which can be used to figure the gain or loss, the exclusion, and the taxable gain from a sale. Note that line 3 is the amount realized, line 4 is the adjusted basis, and line 5 is the amount of gain or loss from the sale.
Gain = Amount realized > Adjusted basis
Gain from the sale or exchange of a main home is not excludable from income if allocable to periods of nonqualified use. Generally, nonqualified use means any period in 2009 or later where neither the taxpayer nor spouse (or former spouse) used the property as a main home (with certain exceptions). Refer to Publication 523 for the list of exceptions to a period of nonqualified use. To figure the portion of nonqualified use, multiply the gain by the following fraction:
Total nonqualified use during period of ownership in 2009 or later
This issue can be complex. Refer taxpayers with "nonqualified use" issues to a professional tax preparer.