Investors & landlords

Your explanation and formula are very clear. My main question is, am I allowed to take the max gain exclusion (after deprivation, up to 250k, single) even though I rented rooms?  The rented rooms shared a dwelling with my primary residence.