About once every 90 days, publicly traded companies have to face their shareholders and let them know how their businesses have performed over the past quarter. Those earnings releases often bring with them all sorts of news that can move the market.

Sometimes that news is bad, which can knock a company's stock down. Yet that can provide an opportunity for investors to buy shares at a bargain price in a company that still look solid over the long term, despite facing some short-term pain.

With that in mind, three Motley Fool contributors went looking for companies whose earnings calls left their shares down, but not out. They found Starbucks (SBUX 1.85%), Datadog (DDOG -6.19%), and Bristol Myers Squibb (BMY 2.09%). Read on to find out why, and decide for yourself whether the market's short-term pessimism has created a long-term opportunity to pounce on.

Pensive investor in a down market.

Image source: Getty Images

The No. 1 coffee slinger has cooled down far too much

Eric Volkman (Starbucks): I think any notable dip in Starbucks provides a fine chance to get this tasty grande latte of a stock at a discount. After publishing its fiscal second-quarter results, the company saw its shares hit with a monster sell-off that erased nearly 20% of their value. And that's not fair.

It was understandable that investors weren't impressed by the quarter. I get that the company missed by a fairly long jump on both the top and bottom lines and posted declines in its all-important comparable-store sales.

But this is Starbucks we're talking about here, folks. It's the unavoidable java stop that's a constant sight in nearly every American city -- and still an attraction in many thriving municipalities around the world.

The Starbucks stores I visit near my Southern California home are basically just as busy as they've ever been; this doesn't make me jump for joy as a customer, but I'd be heartened and eager to hold my shares if I were an investor.

So by my admittedly anecdotal experience, it appears that it's not feeling that pinch everywhere. On top of that, the sales drop-offs could be due more to economic factors than anything else. Other companies in the food and beverage space, such as McDonald's, have said recently that their customers are starting to be more cautious about their spending.

Starbucks isn't shrugging its shoulders at this development. It's taking active steps to improve its business and bring back the occasional customers who seem to be turning away from it. Technological advancements should reduce waiting times for drinks and snacks; meanwhile, new offerings in both categories are likely to stir interest and encourage more visits.

Starbucks is a long-term play on the world's love of coffee. That's never going to fade, so I'm chalking up the sour second quarter to temporary rather than permanent factors, and ones that aren't necessarily under the company's control. I very much doubt the java king's stock is going to stay at this depressed price for long.

A very good dog

Jason Hall (Datadog): When the leader in cloud-data security and observability reported first-quarter results, shares fell sharply. This was despite the company reporting 27% revenue growth, seeing losses under generally accepted accounting principles (GAAP) turn into profits, and a 60% increase in free cash flow.

So why the disconnect? In short, the market is always looking ahead. In this case, it saw the expectations from management, and downvoted the 22% revenue growth the company is forecasting for the second quarter and the rest of 2024. The market always wants more of what you were doing and doesn't love it when the growth story slows.

The irony is, we've seen how this short-term focus plays out, even over the past 18 months:

DDOG Chart

DDOG data by YCharts.

Factoring in this week's drop (not shown above since the data is too fresh), Datadog's stock has fallen post-earnings in four of the last six quarters. But shares over that same period are up a lot because investors have steadily focused more on the strong increase in profitability and cash flows, and become less concerned over decelerating growth.

When you look closer, though, things are very interesting. Based on the 31% free-cash-flow margin it earned in the first quarter, and full-year guidance of $2.6 billion in revenue, that's $800 million in free cash flow (FCF) in 2024. That puts share prices at around 48 times its potential 2024 FCF.

At recent prices, Datadog stock trades for about 75 times trailing FCF and has averaged about 88 times FCF since 2022, when it began generating positive cash.

With very good prospects to keep growing FCF at high rates for many years to come, that strikes me as a price worth paying.

There's a lot of bad news now priced into this company's shares

Chuck Saletta (Bristol Myers Squibb): When Bristol Myers Squibb reported its most recent earnings, the market swiftly punished the company's shares. Not only did it deliver a massive loss for the quarter, but it also gave downward guidance for the rest of 2024, providing all the reasons that many market participants needed to be spooked out of owning it.

As if that earnings miss weren't enough, the company faces a patent cliff, with Eliquis and Opdivo facing loss of patent protection over the next few years. Still, that's nothing new for companies in the pharmaceutical business, and its strong pipeline means that the company could very well come up with ways to replace those blockbusters' revenue.

Yet with that decline in its share price comes a potential opportunity. On average, analysts expect the company to be able to deliver $6.92 per share in earnings in 2025 -- after the immediate crisis passes. At its recent market price of $44.74 per share, that means the company is available for around 6.5 times its anticipated earnings for next year.

On top of that, it currently pays out $2.40 per share in dividends each year, giving investors a substantial yield near 5.4%. With its earnings expected to be soft in 2024, that dividend could be at risk.

Still, with a comfortable cash position on its balance sheet and solid operating cash flows despite its earnings challenges, it is likely that management will be willing to retain its dividend. That's especially true if it really believes in its anticipated 2025 earnings recovery.

Put it all together, and the market's recent post-earnings souring on Bristol Myers Squibb's stock has put it in a position where the risks appear reasonably balanced by the potential rewards. When it comes to stocks that have been knocked down, that's not a bad place for patient investors to consider as an entry point for a company's shares.

Get started now

While the market will often punish companies that miss earnings or guide downwards, its short-term focus often works both ways. As a result, legitimate bargains rarely last long.

So make today the day you decide for yourself whether one of these three companies has been excessively punished by the market for its recent earnings. If it turns out that you're right, you'll be better set up for the potential rewards that long-term ownership can often bring.