You can have 158 Standard Footman(s) at Marquess/Marchioness

Notes: the amounts are rounded down, so in case of hard cap calculation, you might want to buy one more.
Some common sense is needed when interpreting the results: obviously you can't expect to fill your hard cap with stage 1 apprentices. If you can't promote a unit, it won't reach the hardcap.
Suggested use: first figure out how many units of a certain type at a certain level you want at a certain rank you can have at the hardcap. After that figure out when you'll be able to buy them at the softcap.