Sale of home

If I sell my home and have a million dollars in gain and qualify for the 121 exclusion can the excess gain above the 500,000 be used to  reduce the basis for my new home