There's a lot more to calculating how many fish your aquarium can hold than the length of the fish. For instance, is the fish tall and skinny, short and fat, or some other variation? Unfortunately, many new aquarists are told that they can buy an inch of fish for every gallon of water they have in their fish tank. While it may seem helpful at first glance, purchasing fish using this rule is one of the worst moves you can make - especially since not all fish tanks are created equal.
For example, the typical tall 55 gallon show tank that most starter kits sell cannot hold nearly as many fish as a 40 gallon breeder tank can. Confused? A tall, narrow tank has less surface area - the less surface area you have in your fish tank, the less dissolved oxygen actually reaches your fish. You're better off with a short, wide tank than a long, narrow one.
In addition to the "actual" size of your tank, not the number of gallons that it says it can hold, you will also need to factor in the species of fish you are getting - especially their diet. A narrow, skinny fish will not eat as much as a fish with more girth. For example, while a guppy and a molly will reach a comparable adult size, the molly will eat much more than the guppy will - and thus produce more waste in your aquarium. Additionally, a fish with a
meaty diet will produce more toxic ammonia through its waste than a fish that is primarily
herbivorous.
Instead of trying to calculate the number of fish you can purchase with inches per gallon, make sure you are taking into account the square inches of fish, their diet, eating habits, and how active they are, before you make your final decision.