I am working on stats for a sports team, and one of the stats I have the ratio of
Shots on Target (Which I call
SOTP). So, for instance, if a player has 2 shots, and one's on target, their
SOTP ratio is 1/2 or 50%.
Now I have a problem that I can't seem to solve. The software that generates the stats lets me put in numbers, variables, or basic operators (
+, -, /, *, and
**, which represents
^). So for the
SOTP I have $SOTP = SHOTSONTARGET/SHOTS$. My problem arises when a player has zero shots since the denominator is zero. If this is the case, the software automatically returns nothing, which works until I need to use the
SOTP ratio in another operation. For instance, I have something that generates points based off passes, goals, etc, but when
SOTP is equal to nothing, the points return nothing, even if the player has points.
So my question is, is there anything I can do to avoid the zero in the denominator by just using basic operators, constants, and variables?
Thanks for your help.