There is no zombie formula. The 3 types of zombies featured in the Monster Manual aren't independently created creatures, but they are independent of each other.
The basic Zombie is one of the staple enemies of D&D, along with other swarming mooks such as Skeletons, Goblins, and Kobolds.
The Ogre Zombie is simply an interesting variant on the regular Ogre. Lower AC makes players feel more effective, with higher HP making sure the battle is no less challenging. If you look at the melee attack of the 2 creatures, you can see that it is identical, because they're effectively the same creature.
The Beholder Zombie is one of 4 types of Beholders. They all follow the same pattern, but with varying levels of power. The basic Beholder is a CR 13, with the Death Tyrant being a slightly more powerful version at CR 14, the Beholder Zombie a much weaker version at CR 5, and the Spectator bringing up the rear at CR 3.
Spectrums like this one are fairly common in the Monster Manual, particularly with iconic creatures like beholders. This allows a DM to include one of the classic monsters in their campaign regardless of whether it is a high- or low- level campaign. Other examples of this phenomenon include golems, hags, demons, devils, dragons, giants, angels, lycanthropes, and even oozes. (I could go on for longer, but I think you get the idea.)
If you want to zombify a creature, start by deciding whether you want being a zombie to make it more, less, or equally challenging. Then add zombie traits such as Undead Fortitude, lowered mental abilities, and increased Constitution. You can adjust HP and AC depending on how challenging you want it to be. You'll have to do this individually for each creature, though, if you want to maintain its unique flavour while adding zombie flavour. The DMG has instructions on how to recalculate CR once you finish modifying your creature.