This is the formula for Stock Average Calculator ((Quantity 1 * Price 1)+(Quantity 2 * Price 2)) / (Quantity 1 + Quantity 2).