How to interpret the 2 of the 5 year primary home rule for capital gains on property?

I have a 2 family home that I have lived in 1 unit since I have purchased it. The other unit, I have rented it out most of the time with the exception of 5 months in 2019 and since March 2021. In order to benefit from the capital gain exclusion on primary home, i know i need to live in there for 2 years.  I am ok to give up rent for 2 years so that the whole house can qualify for the exclusion. can I add the 5 months and count 19 months from March 2021 to qualify