For some reason when we had our upstairs hall bath redone we just left the existing exhaust fan despite it being loud and clattery and probably on its last legs. SO's mom and sister are coming for a visit this week so I finally got around to installing the new one I bought a few months ago. I've learned a couple of things. First, they come in different sizes and for whatever reason the one in our downstairs bathroom is bigger. I had, of course, bought one like that. Second, you don't have to replace the whole box. You can just replace the motor unit and the bracket it attaches to. the motor unit even has a regular 110 plug and the box, which can remain, has an outlet, so you don't need to do any wiring work if you're just replacing the fan/motor unit.
As a result SO had to go to home depot and get a different motor/fan unit to match what was there, and it was SUPER easy to install. And we now have a whole unit for when we redo the master bathroom in a couple of years. (The master currently doesn't have a fan since code only requires a window. We want a fan regardless of code so we'll eventually use the one I bought a few months ago.)