Arguably, the single most important skill investors can learn is how to value a stock. Without this ability, investors cannot independently determine whether a company's stock price is low or high relative to its performance and growth projections.

Why assign values to stocks?
Investors assign values to stocks because it helps them decide if they want to buy them, but there is more than one way to value a stock.
On one end of the spectrum, active investors -- those who believe they can develop and execute investing strategies that outperform the broader market -- value stocks based on the belief that a stock's intrinsic value is wholly separate from its market price. Active investors calculate a series of metrics to estimate a stock's intrinsic value and then compare that value to the stock's current market price.
Passive investors subscribe to the efficient market hypothesis, which says that a stock's market price is always equal to its intrinsic value. Passive investors believe that all known information is already priced into a stock, so its price accurately reflects its value. Most adherents to the efficient market hypothesis suggest simply investing in an index fund or exchange-traded fund (ETF), rather than taking on the daunting task of trying to outsmart the market.
Using GAAP earnings vs. adjusted earnings to determine the P/E ratio
GAAP is shorthand for generally accepted accounting principles, and a company's GAAP earnings are those reported in compliance with these principles. A company's GAAP earnings are the amount of profit it generates on an unadjusted basis, meaning without regard for one-off or unusual events such as business unit purchases or tax incentives received. Most financial websites report P/E ratios that use GAAP-compliant earnings numbers.
Non-repeating events can cause significant swings in the amount of profits generated, which is why some investors prefer to calculate a company's P/E ratio using a per-share earnings number adjusted for the financial effects of one-time events. Adjusted earnings numbers tend to produce more accurate P/E ratios.
Continuing with the above example, Walmart's P/E ratio of 42.44 was calculated using unadjusted (GAAP) earnings of $2.34. The company, in its latest quarterly earnings report, indicates its adjusted EPS for the same period was $2.51.
Using this adjusted EPS value, we can calculate Walmart's adjusted P/E ratio as 39.57 -- the result of dividing $99.31 by $2.51.
What's a good P/E ratio for a stock?
A P/E ratio that is good for one investor may not be enticing to another. P/E ratios can be viewed differently depending on an investor's objectives, which may be more strongly oriented toward value or growth.
Value investors prefer low P/E ratios. A stock for which the valuation implied by the market is substantially below its intrinsic value is likely attractive to value investors.
Growth investors are more likely to buy a stock with a high P/E ratio based on the belief that the superior rate of earnings growth, if not the absolute value of the earnings themselves, justifies the high P/E ratio.
How investors can use variations of the P/E ratio
Investors, particularly growth-oriented ones, often use a company's current and past P/E ratios to calculate two other metrics:
- The forward-looking P/E ratio
- The price-to-earnings to growth (PEG) ratio.
The forward P/E ratio is simple to compute. Using the P/E ratio formula -- stock price divided by earnings per share -- the forward P/E ratio substitutes EPS from the trailing 12 months with the EPS projected for the company over the next fiscal year. Projected EPS numbers are provided by financial analysts and sometimes by the companies themselves.
The PEG ratio accounts for the rate at which a company's earnings are growing. It is calculated by dividing the company's P/E ratio by its expected rate of earnings growth. While many investors use a company's projected rate of growth over the upcoming five years, you can use a projected growth rate for any duration of time. Using growth rate projections for shorter periods of time increases the reliability of the resulting PEG ratio.
A stock with a PEG ratio below 1.00 is considered exceptionally valuable due to its impressive projected growth rate. However, with any financial metric, it's important to see how a company compares to its peers.
Related investing topics
Other relevant factors for valuing a stock
Aside from metrics like the P/E ratio that are quantitatively computed, investors should consider companies' qualitative strengths and weaknesses when gauging a stock's value.
A company with a defensible economic moat is better able to compete with new market participants, while companies with large user bases benefit from network effects.
A company with a relative cost advantage is likely to be more profitable, and companies in industries with high switching costs can more easily retain customers. High-quality companies often have intangible assets, e.g., patents, regulations, and brand recognition, with considerable value.
As Warren Buffett famously said, "It's far better to buy a wonderful company at a fair price than a fair company at a wonderful price."