Pessimism among investors shouldn't deter people from carefully buying shares of high-quality companies that have endured massive declines, CNBC's Jim Cramer said Friday after a widespread sell-off in the stock market.

On Thursday, survey results from the American Association of Individual Investors showed that pessimism among retail investors was at its worst in some 5½ years, a symptom of the market's volatility in recent months.

But Cramer, a longtime stock-picker whose mantra is "there's always a bull market somewhere," urged investors "to think a little more long-term."

"We still have plenty of companies that are doing well and their stocks actually do get cheaper as they go lower," he said on "Mad Money." "Unfortunately, this is one of those times where you enter the house of pain the moment you buy a stock."

That means investors have to be exceedingly careful and choose their buys wisely, Cramer said, choosing the stocks of Adobe, Costco and Johnson & Johnson to illustrate his point.

"If you bought any of those stocks yesterday, you'd say, 'Wow, that had to have been the worst financial decision I've ever made,'" he said after all three stocks closed dramatically lower. "Adobe and Costco must've had shortfalls. [...] The J&J story about the company knowing about asbestos in talc? Dreadful."

But stock-pickers who are open to a wider frame of reference for these stocks — say, several months rather than several weeks — might have an easier time rationalizing why these stocks look "cheap" here, Cramer explained.

"In reality, ... Adobe reported a terrific quarter, but the stock had already run up dramatically. Same with Costco. People just assumed the numbers were bad, though, because the stock went down. There was no rigor to the process at all. In short, Adobe and Costco are broken stocks, but they're not broken companies," he said.

The "Mad Money" host even had a cautiously positive outlook for Johnson & Johnson, which he said would "come out OK," though "not at first."

All in all, negative sentiment shouldn't deter investors from buying into shares of top-notch companies, as long as they've done their homework and are sure the pain is unwarranted, argued the "Mad Money" host.

"Sentiment is very negative here. Historically, that's made for some good buys, for some excellent opportunities, but this time might be different," he noted. "That said, even if the market keeps getting clobbered, some individual stocks have come down so far, so fast, that they're now getting too cheap to ignore. It's just that, right now, there aren't very many of them."

Disclosure: Cramer's charitable trust owns shares of Johnson & Johnson.

Questions for Cramer?
Call Cramer: 1-800-743-CNBC

Want to take a deep dive into Cramer's world? Hit him up!
Mad Money Twitter - Jim Cramer Twitter - Facebook - Instagram - Vine

Questions, comments, suggestions for the "Mad Money" website? madcap@cnbc.com