The formula for calculating the cost of goods is as follows; (starting inventory balance + received purchases) - ending inventory balance.