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

bear trap with a roll of $100 dollar bills as bait
Source: Getty Images

What is a stock?

A single share of a company represents a small ownership stake in the business. As a stockholder, your percentage of ownership of the company is determined by dividing the number of shares you own by the total number of shares outstanding and then multiplying that amount by 100. Owning stock in a company generally confers to the stock owner both corporate voting rights and income from any dividends paid.

The cornerstone stock valuation metric is the P/E ratio

The most common way to value a stock is to compute the company's price-to-earnings (P/E) ratio. The P/E ratio equals the company's stock price divided by its most recently reported earnings per share (EPS). A low P/E ratio implies that an investor buying the stock is receiving an attractive amount of value.

As an example, let's calculate the P/E ratio for Walmart (WMT 0.3%). For its fiscal year that ended Jan. 31, 2023, Walmart reported diluted earnings per share of $4.27. At the time of this writing in April 2023, the company's share price is $151.73.

To obtain Walmart's P/E ratio, simply divide the company's stock price by its EPS. Dividing $151.73 by $4.27 produces a P/E ratio of 35.53 for the retail giant.

Why assign values to stocks?

A stock's intrinsic value, rooted in its business fundamentals, is not always the same as its current market price -- although some believe otherwise. Investors assign values to stocks because it helps them decide if they want to buy them, but there is not just 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 posits 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 and, therefore, 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 seemingly impossible task of outsmarting 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 them. 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 increases or decreases 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 35.57 was calculated using unadjusted (GAAP) earnings of $4.27. The company, in its annual report, indicates its adjusted EPS for the same period is $6.29. The adjusted EPS figure accounts for factors such as investment gains and losses, including the gains from the sale of its equity method investment in Brazil, opioid legal charges, and business reorganization and restructuring changes.

Using this adjusted EPS value, we can calculate Walmart's adjusted P/E ratio as 24.41 -- the result of dividing $151.73 by $6.29. 

It's far better to buy a wonderful company at a fair price than a fair company at a wonderful price.
Warren Buffett

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 by different investors depending on their investment objectives, which may be more strongly oriented toward value or growth.

Value investors straightforwardly 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 and 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.

Continuing with our Walmart example, analysts forecast average annual EPS growth over the next year of 8.28%. Dividing Walmart's adjusted P/E ratio of 35.57 by 8.28 produces a PEG ratio of about 4.3. A stock with a PEG ratio below 1.00 is considered as 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. Walmart has a significantly higher PEG ratio than the overall supermarket industry average of 1.77.

Related investing topics

Other valuation metrics

Several metrics can be used to estimate the value of a stock or a company, with some metrics more appropriate than others for certain types of companies.

Price/sales ratio

Along with the P/E ratio, another common metric used to value stocks is the price/sales (P/S) ratio. The P/S ratio is equal to a company's market capitalization -- the total value of all outstanding shares -- divided by its annual revenue. Because the P/S ratio is based on revenue instead of earnings, this metric is widely used to evaluate public companies that do not have earnings because they are not yet profitable. Stalwart companies with consistent earnings such as Walmart are rarely evaluated using the P/S ratio. Amazon (AMZN 0.36%) has a history of inconsistent earnings growth, so despite its massive size, the P/S ratio is a metric investors still prefer to use to evaluate the online retailer.

Amazon's market cap at the time of this writing is $1.06 trillion and its fiscal year 2022 revenue was about $514 billion. Dividing $514 billion into $1.06 trillion results in a P/S ratio for Amazon of 2.06.

Investors who wish to compare the P/S ratios of different companies should be careful to only compare P/S ratios of companies with similar business models. Across industries, P/S ratios can vary greatly because sales volumes can vary greatly. Companies in industries with low profit margins typically need to generate high volumes of sales.

Price/book ratio

Another useful metric for valuing a stock or company is the price-to-book ratio. Price is the company's stock price and book refers to the company's book value per share. A company's book value is equal to its assets minus its liabilities (asset and liability numbers are found on companies' balance sheets). A company's book value per share is simply equal to the company's book value divided by the number of outstanding shares.

A company's price-to-book ratio is only marginally useful for evaluating companies, like software tech companies, that have asset-light business models. This metric is more relevant for evaluating asset-heavy businesses, such as banks and other financial institutions.

It's a (value) trap!

A stock can appear cheap but, because of deteriorating business conditions, actually is not. These types of stocks are known as value traps. A value trap may take the form of the stock of a pharmaceutical company with a valuable patent that soon expires, a cyclical stock at the peak of the cycle, or the stock of a tech company whose once-innovative offering is being commoditized.

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."

John Mackey, former CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool’s board of directors. Robin Hartill, CFP® has no position in any of the stocks mentioned. The Motley Fool has positions in and recommends Amazon and Walmart. The Motley Fool has a disclosure policy.