Good question! I was just looking at this myself, those other questions reminded me I need to add this to the pokedex here :)
Yes, there is a formula, which is not too difficult. Your stat will be twice the base stat plus 5 (or plus 110 for HP), plus any modifiers like IV, EV and Nature.
Maximum IV is 31.
Mavimum EV is 255, which is 63 stat points.
Nature adds on an extra 10%, (not for HP).
So you get: ( BaseStat 2 + 5 + 31 + 63 ) 1.1 with 10 instead of 5 for HP. Then you round it down afterwards.
FORMULA FOR HP:
BaseStat * 2 + 204
FORMULA FOR OTHER STATS:
( BaseStat 2 + 99 ) 1.1
Rampardos has a huge 165 base stat in attack. His max would be:
( 165 2 + 99 ) 1.1 = 471.9 --> rounded down to 471.