Much of Wall Street's attention seems to be fixated on fast-growing technology stocks. But that just means investors have plenty of opportunities in overlooked areas of the stock market. Finding these bargain companies is half the battle. Being able to actually invest and put capital to work is the other side of the equation. 

There are still attractive bargains out there, like these two stocks that sell for lower price-to-earnings (P/E) ratios than the S&P 500's average P/E of 31. Of course, having a lower P/E than the S&P 500 isn't enough all on its own to suggest a company is a bargain. The company also has to have strong financials, and these two do.

Read on to learn why these two fantastic retailers deserve a higher valuation than the market is currently giving them. 

A Home Depot employee uses a rubber mallet to seal the lid on a paint can sitting on a table in a Home Depot store.

Image source: Home Depot.

1. Home Depot: Catering to professional contractors 

As the largest home-improvement retailer in the world, Home Depot (HD -2.10%) generated record revenue of $41.1 billion in the most recent quarter. This was an increase of 8.1% from Q2 2020 when sales jumped 23.4%. During the pandemic, consumers who were stuck at home took on renovation projects and flocked to the company's nearly 2,300 stores to buy anything from deck supplies and garden equipment to interior lighting and paint. 

But it's Home Depot's bread-and-butter professional (or Pro) customer cohort that's been outpacing do-it-yourselfers (DIY) over the past two quarters. Representing 45% of overall revenue (and only 5% of customers), these contractors spend and visit stores more often, which helps boost the company's financial metrics. Thanks to Pro customers, Home Depot produced stellar sales per square foot ($663), return on invested capital (44.7%), and operating margin (16.1%) in the second quarter. It appears as though people are more comfortable now taking on larger projects that they've been holding off.

A strong housing market further supports the demand for Home Depot. Historically low interest rates and short housing supply in the U.S., coupled with the popularity of remote work, will drive people to reconsider their living situations. Moving into a bigger house with a home office will probably require a visit to the local Home Depot. 

Investors can buy shares in this first-class business at a P/E ratio of just 23, which could very well prove to be a smart decision over the long term. What's more, management paid $1.75 billion in dividends and bought back $3 billion worth of stock in the quarter, showcasing its shareholder-friendly capital-allocation policy. 

A customer in an auto parts store looks at a product container while standing in an aisle full of products

Image source: Getty Images.

2. O'Reilly Automotive: Profiting from America's love of driving 

O'Reilly Automotive (ORLY -0.29%) is another stock that trades at a very attractive valuation today. Like Home Depot, the business serves not only the DIY customer but also what the company calls professional service providers (or PSPs). These are repair shops that help customers with more complex automotive issues, and it's a vital group that has contributed to O'Reilly's historical success. 

What makes O'Reilly a great business is that it performs well in both robust economic times and during recessions. For example, revenue increased 41.8% in 2008 and 35.5% in 2009 during the fallout from the Great Recession. And since the start of the coronavirus pandemic, O'Reilly has registered double-digit percentage sales growth in each of the past five quarters.

The company benefits because people tend to drive more often when unemployment is low and the economy is strong. It also clearly thrives in adverse times when consumers delay new car purchases and, instead, do whatever they can to extend the life of their existing vehicles. 

Comps rose 9.9% year over year, and management is expecting the operating margin to come in at 20.5% to 20.9% for the full year. Both numbers demonstrate just how impressive a retailer O'Reilly is. And with more than 5,700 stores in the U.S. today, the business is able to leverage a vast distribution network to get the right parts and tools to its PSPs in a timely manner. 

With a current P/E ratio of 22, O'Reilly provides investors with a rare combination of quality, value, and critical downside protection. And a roughly 50% reduction in the outstanding share count over the past decade certainly hasn't hurt. 

If you're trying to boost your portfolio's prospects, look no further than these two bargain stocks.