I've had females spayed from 5 weeks to 24 months and beyond.
Age should not be factor, health is what matters. I've had rats live to 38, 39, 41, 43 months, so for me 2 years is no longer old for my gang. So if I take in a very healthy female, I will have her spayed no matter the age.
Same with a male, if he's showing signs of aggression, he will be neutered, no matter the age.
Another thing to remember especially when rescuing, most people don't know their pet's real age. A lot of the times, if their rat is say 18 months old, they will say 2 years. A lot of them don't realize that a month makes a difference. I never take people's say so when they tell me a rat's age when rescuing from them.