Warren Buffett is, without question, one of the greatest investors of all time. Over the past 50 years, the company he runs, Berkshire Hathaway (NYSE:BRK-A) (NYSE:BRK-B), has generated compounded average annual returns of 20.8% -- trouncing the S&P 500.

However, the oracle of Omaha hasn't beaten the market nearly as much in recent years. One reason why just might be Buffett's greatest weakness: He hasn't been very good at investing in healthcare.

Chain with breaking link

Image source: Getty Images.

Past

Warren Buffett once famously stated, "If you aren't willing to own a stock for 10 years, don't even think about owning it for 10 minutes." Looking at Berkshire Hathaway's investments in the 21st century, however, shows that Buffett hasn't always appeared to be willing to own healthcare stocks for 10 years. He probably wishes he had.

For example, Buffett added large health insurance stock UnitedHealth Group (NYSE:UNH) to Berkshire's portfolio in late 2006. In early 2007, Berkshire bought another health insurer, Wellpoint, which later became Anthem.By the first quarter of 2010, though, Buffett had sold both stocks. 

We don't know the exact date when Berkshire bought its positions in the two health-insurance stocks. However, it's a certainty that Buffett lost by double-digit percentages on both positions. He might have lost more than 30% on UnitedHealth Group. But just look at how both stocks have performed compared with Berkshire Hathaway stock since the end of the first quarter of 2010 -- after Buffett sold Anthem (Wellpoint) and UnitedHealth Group.

UNH Chart

UNH data by YCharts

Both of the stocks that Buffett wasn't willing to hold onto for 10 years went on to greatly outperform his own company's stock. UnitedHealth Group nearly quadrupled Berkshire's gains during the period after Buffett sold his shares in the health insurer.

But that's not the only time Buffett threw in the towel too early on a healthcare stock. In the third quarter of 2011, Berkshire bought CVS Caremark stock, now known as CVS Health. By the second quarter of 2012, less than a year later, Berkshire no longer owned the giant pharmacy-services company. Buffett probably made a profit on CVS Health stock, but he forfeited additional gains of close to 70% if he had kept his shares.

Present

Berkshire Hathaway currently owns three healthcare stocks: DaVita (NYSE:DVA), Johnson & Johnson (NYSE:JNJ), and Sanofi. Johnson & Johnson and Sanofi have been in Berkshire's portfolio since 2006, while DaVita was added in 2011.

At first glance, you might think it's good that at least Buffett has retained some healthcare stocks for the long term rather than selling too early. There's more to the story, though. Buffett drastically cut his position in J&J in 2012 by roughly 95%. At the time, he was quoted as saying the company had "some wonderful products and a wonderful balance sheet, but too many mistakes have been made." Those mistakes primarily referred to several J&J product recalls. 

You probably know where this is going. Had Buffett held on to his J&J stock, his initial large stake in the healthcare giant would have nearly doubled. With dividends included, Johnson & Johnson would have beaten Berkshire's performance in the period following Buffett's big sell-off.

What about the two healthcare stocks for which Buffett hasn't slashed his positions? Sanofi has generated stock returns in the single-digit percentages at best over the 11 years it's been in Berkshire's portfolio. Dividends make the overall return look better, but Sanofi has still greatly underperformed Berkshire during the period.

As for DaVita, Buffett didn't sell shares of the dialysis services provider but instead added to his position over several years. However, like most of his other healthcare investments, it hasn't turned out all that great, either. DaVita stock has been on a general decline since 2015. Since Berkshire added DaVita, its returns have badly trailed both Berkshire stock and the S&P 500.

BRK.A Chart

BRK.A data by YCharts

Future?

Warren Buffett is a very wealthy man, but he'd probably be much wealthier -- as would Berkshire Hathaway shareholders -- if he had made better decisions on healthcare stocks. If Berkshire's having added no new healthcare holdings in the past five years is any indication, it could be that Buffett will decide to avoid healthcare entirely in the future.

On the other hand, Buffett is a smart man and no doubt realizes the potential for the healthcare industry. With the baby boomer generation aging, demand for healthcare services will definitely rise. New healthcare technologies hold the potential to generate fortunes for astute investors.

It only takes one big winner to make all the losing stocks in an investment portfolio seem irrelevant. That's been the case for Buffett overall. He once said, "What we learn from history is that people don't learn from history." Warren Buffett is a student of history. Don't underestimate his ability to learn from his past mistakes.

Keith Speights has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Berkshire Hathaway (B shares) and Johnson & Johnson. The Motley Fool owns shares of DaVita. The Motley Fool recommends CVS Health and UnitedHealth Group. The Motley Fool has a disclosure policy.