Could a solid shot go through many people, or did it generally the overall force of the projectile get absorbed by one guy (I doubt)? Given a tight formation, how many people could you expect to take out with a direct hit?
So there are different sizes of cannon but the effects are not too variable. Some of the smaller cannons, like 3 pounders would not be able to kill quite so many people however the reason for this would be the loss of speed when the shot bounces off the ground rather than when it hits someone. But generally once you get to the 6 pounders, 9 pounders and 12 pounders used by the armies in the field the main variable would be range rather than how many men you can put a shot through.
In regards to how many people a ball can go through? Lots, there's an account during the Napoleonic wars of a round shot hitting the side of a square just right and killing 20 or so people in one go. Just traveled straight down the line and through 20 people.
This was not a frequent occurrence though, with most shots travelling through the formation and killing 2-6 people before continuing on out the back of the formation.
Now, what it is possible to do, is to bounce the shot of the ground so that it keeps bouncing through regiments a few feet off the ground. Like you would skim a stone across water. So the shot lands in front of a regiment then bounces up and into it at chest height, goes through that regiment and kills some people, hits the ground behind them, bounces off the ground and carries on to hit the next regiment a hundred yards behind that one then even bounces again to do it a third time. This was done quite a lot and with great effect during the Napoleonic Wars
The problem this suffers from is that you need hard ground, either frozen solid or baked dry. If you have damp, squidgy ground the shot is not going to bounce but rather bury itself in the mud first chance it gets. That and it's not an easy thing to pull off without the correct experience and training.
So if the shot is good enough, and conditions are good enough you could have a ball travel for 1000 yards bouncing along the ground before coming to a stop. Even then, when a ball is rolling along the ground it still easily has the potential to seriously hurt people. There's an account from the siege of Copenhagen where a British soldier put his foot out to stop a cannonball that was rolling past his line, as one might do a football, and it broke his leg.
So to summarise: larger cannon balls go further and so can generally kill more people; conditions need to be good (hard ground); the accuracy of the shot must be good (hitting not just the enemy formation but hitting it somewhere where it can bounce and potentially kill more people) and of course luck, if you manage to hit a battalion (or battalions) in column or from side angle you're going to have a lot more people to go through.