The denominator is a choice, and the same company therefore has more than one ratio at any moment. A trailing ratio uses earnings already reported, which is a matter of record but describes a year that is over. A forward ratio uses an estimate of earnings not yet earned, which is more relevant and is a forecast. Neither is wrong, and neither is comparable to the other. Two sources quoting a ratio for the same company on the same afternoon can differ substantially for no reason other than which twelve months they chose, so the first question about any quoted ratio is which earnings it used.
A company with no profit has no ratio, and that limitation is larger than it sounds. Divide a price by a negative number and the result is meaningless rather than merely unflattering, so the convention is to report no ratio at all. The effect is that the measure is unavailable for early-stage companies, for cyclical businesses in a bad year, and for any company working through a loss, which is a large share of the cases where people most want a valuation shortcut. A screen that ranks by this ratio therefore does not rank those companies badly. It omits them.
Earnings are an accounting figure, which is a different kind of number from the price. The numerator is observable and updates continuously. The denominator is produced under accounting standards that involve judgment about timing and about which costs belong to which period, and it can be moved by events that are not repeatable, such as a one-time gain on a sale or a large write-down. A ratio can therefore look unusual for a year simply because the denominator was unusual for a year, which is why the SEC's framing points at comparison against the same company's past rather than at a single reading.
Share count sits inside the denominator, so it can move the ratio without the business changing. Earnings per share is total profit divided by the number of shares outstanding. A company that buys back shares has fewer of them, so earnings per share rise and the ratio falls even when total profit is flat. A company that issues shares produces the opposite effect. Both are real changes in what each share has a claim on, and neither is a change in how much the business earns, so a movement in the ratio needs to be traced to one or the other before it means anything.
The price is on top, which produces a specific and well-known trap. Because the numerator is the price, a falling share price lowers the ratio immediately while the reported earnings underneath it update only when the company next reports. So a deteriorating business can screen as steadily cheaper while it deteriorates. That mechanism, and what to do about it, is the subject of our page on value stocks, which works through it with a paired example. The point to carry from here is narrower: a low ratio is a statement about arithmetic, not about a bargain.
What the ratio is genuinely good for. Comparison, in two directions and no others. Against the same company's own history, it shows whether the market is currently paying more or less for the same stream of profit than it used to. Against similar companies, it shows whether one is priced differently from its peers, which is a question worth asking even though the answer is usually a reason rather than an error. Across unrelated industries the comparison breaks down, because businesses with different growth rates, different capital needs and different stability of earnings are not supposed to trade at the same multiple. Other measures exist for cases this one cannot handle, including comparing price with book value, and each carries its own weaknesses.