TeX source:
\dfrac{\text{Cost of goods sold}}{\text{(Beginning inventory+Ending inventory)/2}}