Moved Excel formulas into Python.

Allows for better manipulation and formatting of data.