I would recommend using a commercial program/app that does the above. The regulations are complex and non-compliance can be a major issue - spreadsheets are notorious for hiding/introducing errors and, realistically, are not the right tool for the job. No need to re-invent the wheel, especially if it ends up triangular.