Walgreens Boots Alliance (WBA -1.26%) has undergone a lot of changes over the years. But not all of them have paid off. Today, the company's strategy involves investing billions into primary care, as it plans to open hundreds of clinics across the country through a partnership with VillageMD. It's looking to take on a greater role in healthcare, leveraging the trust consumers have in its business.

And while Walgreens remains a trusted neighborhood pharmacy, has the healthcare stock proven to be a trustworthy investment? Let's look at how the company has changed in recent years and how a $10,000 investment in it five years ago would look today.

Pharmacist helping a customer.

Image Source: Getty Images.

It's been a bumpy ride for the business

In 2017, Walgreens was just a few years removed from its merger with Alliance Boots, a U.K.-based health and beauty group. With a broader business and more of a geographical reach, there were significant growth opportunities for Walgreens to pursue. But the numbers tell a different story, as sales growth has been underwhelming in recent years:

WBA Revenue (Annual) Chart

WBA Revenue (Annual) data by YCharts

Today, the company looks to be pivoting more toward the U.S. market, however, as it is divesting other assets. Walgreens sold its European distribution business, Alliance Healthcare, to Amerisource Bergen in 2021 for $6.5 billion. And now, it's rumored to be in talks to sell its U.K.-based Boots business as well, which has more than 2,200 health and beauty stores. That would simplify its business even further and free up additional resources, likely to help grow its primary care clinics in the U.S. market.

Suffice to say, it hasn't been a straight or predictable path for Walgreens in recent years. But just how good of an investment has the stock been over the past five years?

Here's how a much a $10,000 investment would be worth now

Given the company's challenges and a lack of significant growth, the following chart shouldn't be too much of a surprise. Shares of the company have been split nearly in half and would have led to a mammoth decline in a $10,000 investment:

WBA Chart

WBA data by YCharts

The one benefit, however, is that the company's dividend has remained intact. Walgreens has continued raising it during all those years, and its streak of rate increases now sits at 46 straight years. It is just four years away from becoming a Dividend King. If you count the company's dividend, then you would have recouped some of your losses:

WBA Total Return Level Chart

WBA Total Return Level data by YCharts

The unfortunate reality is that you would have been better off investing in the S&P 500. While the stock's dividend of 4.4% is better than the index's average yield of 1.4%, a high payout by itself isn't enough to make a stock a good buy, or make up for underperforming returns.

Is Walgreens a good buy today?

The problem with Walgreens is that with so many moving pieces and the company shifting gears, it's hard to assess and predict how well it will perform in the next year, let alone the next five. With behemoths such as Amazon and Walmart getting deeper into healthcare, the former acquiring an online pharmacy while the latter is launching health centers, competition could put pressure on Walgreens' already thin margin. 

The positive is that the stock is heavily discounted -- Walgreens trades at just six times its earnings. That doesn't mean it's a slam dunk to be a good buy, but it does compensate investors for some of the risk and uncertainty ahead.

Walgreens remains a top name in pharmacy retail and is a trusted brand among consumers. And by simplifying its business, focusing on the U.S., building on trust, and opening primary care practices, it could be on a better path forward than when it was perhaps trying to be too broad and diverse. Although the past five years weren't great for Walgreens, I'm optimistic that if it can successfully make profitable changes, the next five will be better.