You'll need to count the 5 years period backwards from the date of application.
Regulation 3 states that absences outside the UK for a total of more than six months in any twelve month period would lapse residency leading to Permanent Residence (PR) and the residency 'clock' needs to be started again.
However, there is some allowance for one absence from the UK not exceeding twelve months for an important reason such as pregnancy and childbirth, serious illness, study or vocational training or an overseas posting.
Hope that clarifies![]()