When your investment time frame is decades long, you need to stick to companies that are large and well established. But you'll also want to focus on those with solid long-term prospects, even if their short-term outlooks aren't great because of business or valuation concerns. Right now, it looks like technology giant Microsoft Corporation (NASDAQ:MSFT), dominant protein provider Hormel Foods Corp. (NYSE:HRL), and biotech giant Celgene Corporation (NASDAQ:CELG) are stocks you could hold for the next 20 years or more. Here's what you need to know. 

A cloud behemoth

Tim Green (Microsoft): After surging about 240% over the past five years, Microsoft is not a particularly cheap stock. Shares currently trade for about 26 times the average analyst estimate for 2018 adjusted earnings, and yield a paltry 1.75%. But the price you pay doesn't matter as much if your holding period is measured in decades.

A man drawing a rising line over a bar chart that it heading generally higher

Image source: Getty Images

Microsoft has successfully navigated the shift to cloud computing over the past few years. Its core Office product has been moved to a subscription model; its Azure cloud platform is a strong No. 2 player behind Amazon Web Services; and other subscription-based products like Dynamics 365 are growing fast. During the fiscal second quarter, Office 365 commercial revenue jumped 41%, Azure revenue nearly doubled, and Dynamics 365 revenue was up 67%.

In total, commercial cloud revenue grew 56% to $5.3 billion, putting it above a $20 billion annual run rate. Microsoft's aggressive push into cloud computing and subscription software should give investors some confidence that the Microsoft of old, slow to adapt and caught flat-footed by mobile devices, has been replaced with a far nimbler company.

Tech companies, even dominant ones, come and go. If you want to invest in a tech company that will almost certainly be around in 20 years and will probably still be doing well, Microsoft is a good bet.

On sale while it adjusts to changing customer tastes

Reuben Gregg Brewer (Hormel Foods Corp.): Hormel makes Spam, an iconic brand of potted meat that isn't exactly considered haute cuisine. But don't get caught up in that because Spam is just one of 35 brands the company owns that have a No. 1 or 2 position in their segment of the grocery store. Hormel's portfolio, meanwhile, spans across the entire grocery experience, from the deli to the shelf-stable products in the center of the store.   

The stock, however, has been struggling because consumer buying patterns are shifting. That's happened before and will again. Like it has in the past, Hormel is adjusting. For example, it has been selling slow growth products (like Diamond salt) and buying brands that resonate more with customers (Justin's nut butters and Wholly Guacamole). More recently, it has begun to build up its position in the deli segment (acquiring Columbus Meats), where sales growth has been outdistancing all other areas of the grocery store.   

A bar chart showing that deli sales are outdistancing all other portions of the grocery store

Hormel is expanding in the high-growth deli aisle. Image source: Getty Images. 

It's also moving more aggressively into foreign markets, which only account for 6% of the top line. On this front, it recently opened a new production facility in China and bought a South American meat company (Ceratti) that it plans to use as a foundation for further expansion. These are the types of steps that have allowed Hormel to grow its business over time and increase its dividend for an incredible 52 consecutive years, making it a Dividend Aristocrat. And with the 2.2% dividend yield toward the high end of its historical range, now could be a good time to buy the company for the long term while other investors are thinking short term.   

A great bargain in biotech

George Budwell (Celgene): In a somewhat stunning turn of events, shares of blue-chip biotech Celgene have lost a whopping 25% of their value over just the last 12 months. As a result, trading at a mere 9.1 times expected earnings, they've become an outright bargain. 

CELG Chart

CELG data by YCharts.

The truly weird part about this story, however, is that Celgene garnered one of the highest premiums within the red-hot biotech space before this unexpected downturn, and it did so for the better part of the last decade.  

So what went so terribly wrong in such a short period of time? Celgene's shares have been fading due to three core issues:

  • Questionable business development moves with the pricey buyouts of both Impact Biomedicines and Juno Therapeutics.
  • The unexpected failure of its late-stage Crohn's disease candidate, GED-0301, which potentially wiped out over 2 billion in future revenue. 
  • The recent Refusal to File letter from the Food and Drug Administration regarding the biotech's highly touted relapsing multiple sclerosis drug candidate ozanimod. 

Putting the gloom and doom aside for the moment, though, I think these troubling times could turn out to be an outstanding buying opportunity for investors with a long-term mind-set. Ozanimod, after all, is still a strong candidate to become the company's next flagship product despite this regulatory setback. Moreover, Celgene remains on track to generate top-line growth exceeding an incredible 13% for the next three years, if not longer.

Last but not least, the biotech's clinical pipeline is absolutely rock-solid and arguably among the best in all of biotech. Through various licensing deals, for instance, Celgene was able to bring in megablockbuster candidates such as bb2121 for multiple myeloma and luspatercept for myelodyspastic syndromes. 

So while these recent developments may be off-putting, Celgene, in my view, remains a stellar long-term buy-and-hold company because of its exceptionally strong growth engine and robust clinical pipeline. 

More than a short-term play

True investing is about more than just buying and selling chits of paper. You need to think like an owner if you want to hold an investment for 20 years or longer. That means focusing on companies with the wherewithal to survive good times and bad, like Hormel and Celgene. And sometimes even overlooking an expensive valuation if the long-term growth prospects are strong, like they are at Microsoft. The three companies we've presented here are very different, but I'm certain if you take the time to get to know them, at least one of these stocks will tickle your fancy.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.