It's getting harder and harder to find great companies that are selling for cheap or at modest valuations nowadays. With the broader markets hitting all-time highs and the aggregate price-to-earnings ratio of the S&P 500 at around 26 times, stock prices are looking a little rich for value investors. Luckily, though, there are still some quality companies selling at inexpensive prices. It just takes a little more searching to find them.

Three companies that stand out today as cheap stocks worth buying are biotech giant Gilead Sciences (NASDAQ:GILD), grocery and supermarket behemoth Kroger Co. (NYSE:KR), and oil refiner Marathon Petroleum (NYSE:MPC). Here's a quick look at why they are trading at cheap prices and why you should consider them for your portfolio.

Image source: Getty Images.

Not enough faith in its research pipeline

Gilead Sciences' two flagship treatments for hepatitis -- Harvoni and Sovaldi -- are in that stage of their life cycles where other treatments are taking market share. On top of that, Gilead's HIV treatment suite has been successful while many of its newer treatments have been cannibalizing its prior offerings rather than filling an unmet need. As a result, both revenue and earnings have been sliding recently.

As these flagship products slump, many of the company's newer offerings to treat diseases from pulmonary arterial hypertension, angina, and certain cancers have not been able to offset the declines at its two big treatment markets. Worse yet, the company has seen setbacks with some treatments in its pipeline.

Image source: Getty Images.

That's an awful lot of bad news for one company and doesn't sound like a vote of confidence for Gilead Sciences. But you have to know these things to understand why the stock is so cheap. Today, it sells for an enterprise value of just 5.5 times and a dividend yield of 2.6% because the market hasn't been happy with the recent earnings slips and pipeline flubs.

That being said, treatments failing the phase trial process is part of the game, and Gilead has more than 30 treatments in its pipeline, many of which are tackling the very lucrative nonalcoholic steatohepatitis (NASH) market. What's also encouraging is its giant pile of cash, which it could use to make some acquisitions. Management has said that it is on the hunt for one, particularly in the field of oncology. 

With a decent-sized pipeline of treatments to work through and the financial flexibility to make a timely acquisition, the longer-term future of this company is being underestimated by Wall Street. That makes Gilead look pretty cheap today. 

Falling food prices have grocery-store investors headed for the hills

Saying that the perfect storm has hit the grocery business lately is a bit of hyperbole, but for lack of a better term, we'll call it that. Food prices in 2016 have been falling precipitously. One of the biggest factors is the strong dollar, which is lowering agricultural export levels and keeping more food at home. Toss in lower transportation costs from cheap oil and newer discount grocers such as Lidl and Aldi entering the market and you get the longest streak of food cost deflation since the 1960s. That's great for customers, but has led to a fierce fight among grocers. 

Good time to be a grocery shopper, not a grocery supplier. Image source: Getty Images.

This year's food cost deflation means that inventory values drop quickly, so companies need to turn inventory faster, which then leads to price cuts. Then there is the fight for price-savvy customers who shop around for the best deals. You can quickly see why shares of some of the largest grocery companies in the U.S. have fallen so much this year.

So here is the good news for those looking at the long term: Kroger is arguably the best operator in the business. It has one of the best asset turnover ratios (total revenue divided by total assets) in its industry. Its private label products -- which have better margins than branded products and encourage customer loyalty -- make up 25% of its total sales, and it has unmatched scale, with 2,700 stores. Management has also astoundingly grown comps every quarter since 2004. If you want to put your faith in a company that should win out in a price war, Kroger has the chops. 

Despite its strength in the grocery industry, shares sell today for a reasonable enterprise value to EBITDA of 7.7 times. Certainly, the company's 1.4% dividend yield isn't going to wow anyone, but it has grown at a compounded annual rate of 14% and has reduced its share count by one-third over the past 10 years. These suggest that Kroger is a great business facing tough industry times that makes its stock look attractive today.

The whole is less than the sum of its parts?

Marathon Petroleum can more or less be broken down into three separate entities: the oil refining business, its retail fueling station and Speedway-branded stores, and its midstream and logistics business through its general partner interest in MPLX (NYSE:MPLX). Refining is a notoriously cyclical business -- it waxes and wanes based on the price spread between crude oil and refined products. However, the retail and midstream business has remarkably stable earnings and cash flows.

Image source: Getty Images

What's more, these two businesses have been growing at a respectable clip. Since 2011, EBITDA contributions from midstream and retail combined have grown from $625 million (13% of total EBITDA) to $2.3 billion (46% of total EBITDA) over the past 12 months. 

These less cyclical cash flow businesses have helped fuel the company's shareholder-friendly moves. Since its IPO in 2011, it has repurchased about 28% of total shares outstanding and has grown its dividend at a compounded annual rate of 28%. 

Despite these impressive results and plans to expand its retail and midstream footprints considerably over the next several years, shares of Marathon Petroleum have been trading at a modest valuation. Its enterprise value-to-EBITDA ratio of 10.1 doesn't sound great on the surface, but do keep in mind that this is at a time when refining margins are at five-year lows. As refining margins revert to the mean as they are wont to do and its other segments continue on their strong growth trajectory, shares of Marathon Petroleum are going to look quite cheap.