text: An at bat only consists of the time you are at the plate and get a hit or get out.  Therefore, if you are 3-10 and batting .300, you got on base 3 times via a hit and got out 7 times.  Now, your on base percentage does factor in walks and times that you are hit by a pitch.  Therefore, if you are 3-10 and batting 300 and have 4 walks, then your on base percentage is .500.  It is .500 because you went to the plate 14 times and got on base 7 of those times (3 hits and 4 walks) - half of the time you went to the plate you got on base.