For the purposes of this subpart 2, if a shareholder of an S corporation is both a resident and a nonresident of this state during any taxable period, such shareholder's pro rata share of the S corporation's income attributable to the state and income not attributable to the state for the taxable period shall be further prorated between such shareholder's periods of residence and nonresidence during the taxable period, in accordance with the number of days in each period.