How to calculate average price in share

Do you want a formula using total investment and quantity bought?

Add up the total amount spent on all shares and divide by the total number of shares bought.
Formula: Average Price = Total Cost / Total Shares.