I have developed various spreadsheets as this subject is complex. For example, do you have full or enclosed gaskets? What materials, thicknesses, and characteristics do they have (see ASME VIII, Div. 1 Code and/or TEMA). What is the bolt spacing? edge distance? diameter of bolt? material and temperature and working stress of bolt? net area of bolt? internal pressure? materials of construction of flange? etc., etc.
Check TubeTurns for some fairly old but "standard" calculations. One may also buy a software package by CodeCalc. It has many, not all, of these calculations.