II. WHO RECEIVES AND WHO ADMINISTERS THIS SACRAMENT?
In case of grave illness . . .
1514 The Anointing of the Sick "is not a sacrament for those only who are at the point of death. Hence, as soon as anyone of the faithful begins to be in danger of death from sickness or old age, the fitting time for him to receive this sacrament has certainly already arrived."130
1515 If a sick person who received this anointing recovers his health, he can in the case of another grave illness receive this sacrament again. If during the same illness the person’s condition becomes more serious, the sacrament may be repeated. It is fitting to receive the Anointing of the Sick just prior to a serious operation. The same holds for the elderly whose frailty becomes more pronounced.
Regarding the serious operation - it is not the operation itself. But the illness that is the reason for it.
The instruction of the Rite for the Sacrament notes:
“A sick person may be anointed before surgery whenever a serious illness is the reason for the surgery.”
Anointing is not just for any illness or disorder or any surgery as some mistakenly have thought at times.
The key is being “in danger” of death. That is serious illnesses. Dangerously ill- not only being sick. Though it is to be noted that in cases of “doubt” the Sacrament is given.
(Also if a person perseveres in manifest grave sin they are not to be anointed)