Last month was a tough one for the market. All told, the S&P 500 (^GSPC 1.02%) fell nearly 5% in September. The impacts of inflation and higher interest rates are clearly still taking a toll on the economy, and investors are pricing those impacts into stocks.

Not every S&P 500 constituent, however, lost ground last month. A handful of them managed to log respectable gains.

That disparate bullishness raises an important question. Were these rare gains a signal that you should consider buying these stocks, or were they just random rallies that will soon be unwound?

The answer is (as always), it depends.

The S&P 500's best-performing stocks in September

No fanfare is needed here. September's top-performing S&P 500 stocks were CVS Health (CVS -0.22%), up 7.1%; WestRock (WRK 0.94%), up 9.5%; and Centene (CNC -2.22%), up 11.7%. For comparison, the S&P 500 lost 4.9% of its value last month.

WRK Chart

WRK data by YCharts.

The bulk of CVS Health's gains seemingly stemmed from a couple of analyst upgrades dished out mid-month. Wolfe Research upped its rating on the pharmacy chain to outperform. While Wolfe's analysts acknowledged its recent difficulties, the firm also says there's strong potential for improvement ahead. Evercore ISI upgraded CVS just a few days later, citing the same prospects for renewed growth as well as the stock's relatively low valuation.

There's more to the CVS Health story, however, than last month's upgrades. The stock may have also still been getting traction from the late August announcement that the company is moving deeper into the drugmaking business. Namely, its newly unveiled operating unit -- called Cordavis -- will manufacture and market biosimilar versions of drugs like AbbVie's arthritis and Crohn's disease treatment Humira.

The bullishness for WestRock was rooted in something completely different. On Sept. 12, the company announced plans to merge with rival consumer-packaging company Smurfit Kappa in the second quarter of 2024. The terms of the deal call for WestRock shareholders to receive Smurfit Kappa shares on a one-for-one basis, plus an additional $5 per share in cash. Although the merger has not yet been finalized, WestRock's stock price hasn't changed much since just after the acquisition terms were announced.

As for Centene, investors were mostly celebrating the health plan company's continued streamlining -- an effort intended to create value for shareholders.

The so-called Value Creation Plan unveiled in late 2021 includes a review and potential sale of assets. And to this end, Centene announced in May 2022 that it would be divesting itself of its pharmacy benefits manager arm, Magellan Rx, as well as its rare/orphan disease pharmacy PANTHERx Rare. In November, the company unveiled further plans to shed its Magellan Specialty Health arm. The late-August announcement that it had agreed to sell its hospital operator Circle Health Group to PureHealth, however, seemed to solidify Centene's seriousness about its overhaul.

The news also highlighted the fact that the stock is relatively cheap right now, priced at less than 11 times this year's expected earnings per share, and less than 10.5 times next year's projected earnings per share of $6.70.

To buy or not to buy?

But are any of these tickers still worth buying in the wake of last month's market-beating bullishness?

Again, it depends.

WestRock isn't. As much as its impending union with Smurfit Kappa will add scale and make both operations more efficient, the packaging industry is a crowded one with relatively low margins. Neither company was generating consistently great growth before, and simply combining them isn't likely to alter this reality. Investors would be better served by exploring other opportunities ... like Centene.

The past decade has been challenging for the healthcare industry. Trapped between rising costs, regulatory and legislative requirements, fierce competition, and bloat stemming from too many acquisitions, many businesses in the space are now coming to grips with one overarching reality: Simpler is better. Centene is no exception to this. That's why it's reconsidering which of its pieces it wants to keep owning.

Unlike many corporations that talk more than act, though, Centene is actually downsizing itself for the better.

And it is undervalued, as measured by its trailing and projected price-to-earnings ratios, but also as assessed by the analyst community. Analysts' current consensus price target on the stock is $81.38, versus the stock's present price near $70. Indeed, the stock's current price is below any and all of the analysts' price targets, and these professionals are decidedly bullish on shares with an average rating of overweight.

CVS Health is the trickiest ticker of these three to handicap.

Its prospects for rekindled growth are compelling, as is its dividend yield of 3.5% at its current share price. And like Centene, CVS shares are priced well below even the lowest price target from analysts covering the stock. The lowest target stands at $76 per share, compared to the stock's present price near $70.

Nevertheless, CVS may be a name best avoided for the time being. Proposed regulatory changes aimed at curbing drug-pricing power seem to be common, and the non-pharmacy/general-retailing side of its business is increasingly a liability. The company's also in the process of closing around 900 stores -- a task it will complete by the end of 2024 -- and while that's arguably the right long-term move, it's a near-term distraction and expense. In the meantime, several of its pharmacists simply didn't show up for work last week in protest of workloads that potentially put customers' health in danger. Although that crisis was swiftly addressed, it could also be an indication that other, similar problems are quietly brewing.

Given this backdrop of uncertainty, investors interested in CVS may want to consider other options.

This is how all stocks should be picked, by the way

These stock-buying decisions, of course, have little to do with September's gains.

Sure, a large gain in a single month is worth paying attention to. That's particularly true when the broader market loses ground in the same period. All long-term rallies start out with that first small step, after all. It's always possible a given month's winners are starting sustained moves upward.

Smart investors, however, should always consider the bigger picture. This includes the stock's current valuation, its current price in comparison to analysts' price targets, the company's growth prospects, and the underlying industry's outlook. When this fundamental analysis is done as it should be, one month's performance from the stock becomes the least important buy/sell criterion.