Goodwill is calculated by subtracting the M&A target's book value (written up to fair market value) from the equity purchase price paid for the company.
This equation is sometimes referred to as the "excess purchase price."
Accounting rules state that goodwill no longer should be amortized each period, but must be tested once per year for impairment. Absent impairment, goodwill can remain on a company's balance sheet indefinitely.