While the market bounced back last year, some stocks failed to keep pace with broader equities. That was the case with pharma giant AbbVie (ABBV -4.58%) and e-commerce specialist Etsy (ETSY 0.34%), both of which encountered company-specific issues. Near-term headwinds aside, AbbVie and Etsy have much to offer investors, especially those willing to stay the course and hold their shares for five years or more.

Let's find out why these beaten-down stocks remain excellent buys in 2024 and beyond.

1. AbbVie

AbbVie's revenue dropped last year as it faced generic competition for its blockbuster immunology medicine Humira. Although this was a long time coming, the reality of it seems to have hit some investors hard. However, AbbVie is doing relatively fine, considering that Humira is the best-selling drug in the history of the industry, and it is now a deadweight on revenue growth.

Management anticipates top-line growth to resume next year. Newer medicines such as migraine treatment Qulipta are making meaningful contributions, while Skyrizi and Rinvoq, two immunology therapies that target many of the conditions Humira does, are doing much of the heavy lifting.

AbbVie is also turning to acquisitions to turn the page. In December, it announced a deal to acquire Cerevel Therapeutics for $8.7 billion in cash. Cerevel is a neuroscience specialist that will help complement AbbVie's work in this area. It is going after several conditions with a large unmet need, including schizophrenia and Parkinson's disease.

AbbVie has a full pipeline beyond this acquisition. Some may be worried that its excellent dividend program is at risk, but that seems unlikely. AbbVie hiked its payouts even amid the Humira-related issues, a clear sign that it hopes to maintain its streak of 52 consecutive years of dividend increases.

The drugmaker has the business to support it despite the recent patent cliff. It currently offers a cash payout ratio of 42%. The company's decision to splurge on acquisitiona shouldn't significantly disturb its dividend program, either. AbbVie did not suspend or even slash its payouts, even after its 2020 acquisition of Allergan for $63 billion.

The company's current dividend yield of 3.82% is more than twice the S&P 500's average of 1.47%, and it has increased its payouts by 269% in the past decade alone. AbbVie should continue to deliver solid returns over the long run. Interested investors can take the opportunity to scoop up its shares while they are down.

2. Etsy

Etsy is an e-commerce specialist that encountered some troubles last year. The company is best known for its focus on vintage and handmade goods, which typically aren't very cheap. With lingering economic problems, Etsy's e-commerce platform wasn't delivering the sales growth investors might have hoped for. In the third quarter, Etsy's top line of $636.3 million was just 7% higher than the year-ago period. The company's top-line growth rates have plummeted in recent years.

ETSY Revenue (Quarterly YoY Growth) Chart

ETSY Revenue (Quarterly YoY Growth) data by YCharts

Even Etsy's significant bottom-line increase wasn't as impressive as it seems. The company turned a net loss of $963.1 million into a net income of $87.9 million, but it had to deal with a $1 billion impairment charge related to acquisitions in the third quarter of 2022. Still, there were some encouraging signs for Etsy. For instance, the company's active sellers and buyers grew.

That's an important factor. Etsy arguably benefits from the network effect. People looking for vintage goods will be attracted to a platform known for selling them and that already has a large number of sellers. On the other side of the equation, sellers of such items will also be inclined to turn to those websites where there is already a large ecosystem of buyers, and that's Etsy.

That's how the company has managed to carve out a niche in the highly competitive e-commerce field that features such giants as Amazon. That says a lot about Etsy, and the company is far from done. E-commerce will continue growing, the economy will rebound, and sales growth should also bounce back. Etsy estimates a $2 trillion total addressable market in its niche: It has barely scratched the surface here.

There is plenty of fuel left in the company's growth engine, making it an excellent stock to buy as it continues to underperform the broader market.