The S&P 500 and Nasdaq Composite are both up big in 2023 following tumultuous performances last year. But not all businesses have participated in the wonderful market rally. Even companies that have a solid history of revenue and profit growth can see their share prices get crushed. 

Just look at Dollar General (DG -0.41%). Shareholders in this retail stock have been hugely disappointed lately. Through the first seven months of the year, the stock has plunged 31%. Is it a good idea for investors to buy, sell, or hold Dollar General's stock? Let's take a closer look.

Facing some challenges 

When Dollar General reported results for its fiscal 2023 first quarter (ended May 5), Wall Street analysts were hoping for revenue of nearly $9.5 billion and diluted earnings per share (EPS) of $2.38. The company was unable to exceed this forecast, generating just over $9.3 billion of sales, with diluted EPS coming in at $2.34. 

Making matters worse, management downgraded full-year guidance for both revenue and earnings. And same-store sales, a key metric for any retail business, are expected to rise between 1% and 2%, down from a prior outlook of 3% to 3.5%. And in an effort to conserve cash, the leadership team suspended share repurchases and decided to lower the number of store openings slated for fiscal 2023. 

"We're seeing a much more challenging macroeconomic environment than we anticipated, and this is having a significant impact on our customer spending levels and behavior," CFO Kelly Dilts mentioned on the Q1 2023 earnings call. 

This was a bit of a shock because the thinking was that Dollar General should perform well in what has been an above-average inflationary environment. But clearly the business has underperformed the expectations of both its own executive team as well as Wall Street. And that's certainly not something investors want to see. 

Focusing on competitive forces 

The retail sector is notoriously competitive. There are virtually an unlimited number of businesses out there all vying for a share of consumers' wallets. While Dollar General has had a strong foothold on the lower-priced side of the equation, as evidenced by its expanding store base (now at over 19,000 locations) and growing sales and net income, competition is getting even fiercer. 

Dollar General's direct rivals include Dollar Tree and Five Below, which also offer up a wide assortment of merchandise at everyday low prices. There's also Walmart, a massive retailer that's the biggest grocer in the U.S. 

We also can't ignore e-commerce businesses like Amazon. Thanks to the tech behemoth's ever-expanding logistics footprint, its potential ability to deliver items to more rural areas at lower costs can start to have a meaningfully negative impact on Dollar General if it hasn't already.

What should investors do? 

Despite the notable challenges facing Dollar General, a valid argument can still be made to buy the stock today. After a poor performance so far in 2023, the shares currently trade at a trailing price-to-earnings (P/E) ratio of just 15.9. This is a huge discount to the S&P 500's P/E multiple of 20.4. 

The question to then ask is, "Is Dollar General a better-than-average company?" Based on its stellar long-term history of strong fundamental performance, I think the answer is, "Yes." For those who believe the business can successfully navigate its challenges, buying makes sense. 

For existing shareholders, that's also a reason to hold onto the stock as well. And Dollar General's current dividend yield of 1.4% can still be attractive for some investors. The company has done a nice job of consistently boosting the quarterly payout over the past several years. 

On the other hand, the bearish case makes sense, too, primarily as it relates to heightened competition and the inability to post strong financial results during what has been an uncertain economic time. For shareholders who think this way and who might be sitting on long-term capital gains, perhaps now is a time to think of reducing or selling your position.