If you can get to the ceiling where you want to attach the new fan from an overhead area or the attic, then you will have different choices in the type of box that you install. If it is not possible for you to get to the area above the box, use an adjustable hanger bar that is designed for installation through the hole left by the previous ceiling box.
If you want to replace a ceiling fixture, here are the following i followed during the time i was working on my workshop, which i needed to fix both the fan, work table, and perform some garage door repair too.
1. The power should be turned off at the fuse: Because there may be several pairs of wires in the ceiling box and some may be connected to circuits that has nothing to do with the fixture you’re working on, be safe by using a circuit tester or completely turn off the power to the whole house before trying to replace a ceiling fan. This is the only way to be very sure that all wires in the box are disconnected.
2. Next is to remove any light shades and bulbs from the fixture, then remove the screws and nuts that holds the fixture base to the ceiling box.
3. Remove each blade of the old fan by unscrewing the screws holding them in place. Remove the canopy by removing the screws holding it and slide it down. Remove the screws holding the mounting bracket in place to remove it.
4. Lower the fixture base and then remove the wire nuts or electrical tape.
5. Install the adjustable hanger bar and ceiling box according to the manufacturer’s instructions. Most hanger bars can be installed by pushing them through the hole in the ceiling left that was left by the old electrical box. After the hanger bar through the hole completely, keep rotating it until it is perpendicular to the ceiling joists. You will have to attach the special ceiling box to the hanger bar, thereby locking it in place so as to provide a secure base for the fan.
6. The new fan should be assembled according to the manufacturer’s instructions. Because ceiling fans are heavy, they will need support while you are attaching the wires. Most ceiling fan models will provide you with a way to suspend them below the ceiling box as you are attaching the wires. If your fan model doesn’t, get someone to help you support the fan assembly as you attach the wires. Make use of wire nuts to attach the fan’s wires (black, colored and white wire) to ones matching them in the ceiling box.
7. Attach the fan assembly to the ceiling box with the screws provided.
8. According to the manufacturer’s directions, install the trim and fan blades.
9.Turn the power on and test the installation.