Divide number of hits by the number of at bats (at bats does not count walks+HBP+Catchers Inferference+Sacrifices).
divide the time at bat (AB) by hits (H). In symbols:
ave = AB/H
Note: one usually carries out to 3 places and omits the decimal point.
example : 18 hits in 50 times at bat.
batting average is 18/50 = .360 -- a 360 average -- very good.