Oook. I have a proper answer this time:
Zerokid’s amazing guide is a work of art, and it contains just about anything you need to know about RBY. But for this question, we’re specifically after stat experience, which can be found on pg. 265 under the subhead [M03 - Stat Calculation].
Copy pasting from the guide:
Stat Experience Gained from Battle
Check section M03; 'Stat Calculation' for the basics of Stat Experience. Your Pokemon will gain stat experience for EACH stat equal to:
Stat Experience gained per stat = int(B/(N*E))
B = Base Stat of opposing Pokemon, as seen in my Pokedex. The stat used is the one you will gain stat experience in.
N = Number of Pokemon who saw the defeated opposing Pokemon and are not fainted.
E = 2 if carrying the Exp. All item, 1 otherwise.
If you are carrying the Exp. All item AND the Pokemon saw the defeated opposing Pokemon and is not fainted, that Pokemon has this formula multiplied by 2.
I am holding the Exp. All, and send my Pokemon, a Magikarp (why not?) into battle. Somehow, it wins, defeating a Rattata. How much stat Exp. does it gain?
- B = ?: Whatever Rattata's base stat is for each stat.
- N = 1: Magikarp is the only participant.
- E = 2: I'm carrying the Exp. All.
Also, we must multiply the end result by 2 since I am carrying the Exp. All item, and Magikarp saw the defeated opposing Pokemon and is not fainted.
HP = 2*int(B/(N*E)) = 2*int(30/(1*2)) = 30. Attack = 2*int(56/(1*2)) = 56.
Defense = 2*int(35/(1*2)) = 34.
Etcetera for Sp. Atk, Sp. Def and Speed.
Note that Rattata's Base Defense is 35, and we only received 34 stat experience. Due to rounding, Exp. All sometimes gives slightly less stat experience when it is used, and this is the same for standard Experience points, as seen below.
With the above in mind, the general questions.
But what if multiple Pokemon participated in the battle? The formula in words is:
(Base Stat of Opposing Pokemon) / (Number of Pokemon that Participated) * ('EXP All Modifier') , rounded down to the nearest integer (this is how the 'int' function works in Assembly, which is the language that RBY is coded in).
Thus, stat experience is divided amongst those multiple Pokemon, as is the case for normal experience.
Example: If three Pokemon contributed to a battle against a Fearow (Base attack 90), then they would all receive 30 stat experience for Attack, regardless of who landed the knockout blow.
I believe that also answers the two follow-up questions to the one above.
Hope I helped!