Income Tax Assessment Act 1997
If a *dwelling that was your main residence ceases to be your main residence, you may choose to continue to treat it as your main residence. 118-145(2)
If you use the part of the *dwelling that was your main residence for the *purpose of producing assessable income, the maximum period that you can treat it as your main residence under this section while you use it for that purpose is 6 years. You are entitled to another maximum period of 6 years each time the dwelling again becomes and ceases to be your main residence. 118-145(3)
If you do not use the *dwelling for that purpose, you can treat it as your main residence under this section indefinitely. 118-145(3A)
This section does not apply if the *dwelling was your main residence because of section 118-147 and ceases to be your main residence because of subsections 118-147(3) and (4) .
If you make the choice, you cannot treat any other *dwelling as your main residence while you apply this section, except if section 118-140 (about changing main residences) applies.
You live in a house for 3 years. You are posted overseas for 5 years and you rent it out during your absence. On your return you move back into it for 2 years. You are then posted overseas again for 4 years (again renting it out). You then move back into it for 3 years, after which you sell the house.
You have not treated any other dwelling as your main residence during your absences.
You may choose to continue to treat the house as your main residence during both absences because each absence is less than 6 years.
You can make this choice when preparing your income tax return for the income year in which you sold the house.