The exclusion is not pro-rated. You may, however, qualify for a partial exclusion if the main reason for the sale was a change in workplace location, a health issue, or an unforeseeable event.
See https://www.irs.gov/publications/p523#en_US_2018_publink100073096
Otherwise, you must have owned and used your home as your main home for a period aggregating at least two years out of the five years prior to its date of sale.