Any tools or excel sheets that I can implement to track down the *actual* cost of all raw materials?

To me this is just an accounting question. EVE I don’t think has any easy way in game to calculate this outside of just being able to see your transaction history.

This is just basic Average Cost accounting.

To keep track of it all you just need to write down the incoming material transactions at the price you bought them at and take an average of that in perpetuity to maintain your costs ledger.

On the other side is easier, you just record what you sold it for and there you go. The tricky part is remaining profitable as the cost of inputs change if the revenue of outputs doesn’t change accordingly.