As if this past year hasn't been difficult enough for investors, it's now looking more likely that a recession will happen sometime in 2023.

For months, experts have debated over the likelihood of a recession. According to a March report from analysts at JPMorgan Chase, however, there's now a greater than 50% chance that we'll experience a recession by the end of the year.

Any type of economic uncertainty can be daunting, especially after the volatility we've seen with the stock market over the past year. But there's some solid advice from legendary investor Warren Buffett that can help you get through it.

The one thing more important than short-term volatility

In times like these, many Americans are feeling nervous about the future. But there's a good reason Buffett doesn't worry about it: The market's long-term performance will always be more important than the short-term ups and downs.

Back in 2008, at the height of the Great Recession, Buffett wrote an opinion piece for The New York Times with his thoughts on the future of the market.

"[F]ear is now widespread, gripping even seasoned investors," he writes. "But fears regarding the long-term prosperity of the nation's many sound companies make no sense. These businesses will indeed suffer earnings hiccups, as they always have. But most major companies will be setting new profit records 5, 10 and 20 years from now."

That prediction came true, as the S&P 500 went on to shatter records and experience one of the longest bull markets in history between 2009 and 2020.

^SPX Chart

^SPX data by YCharts

While past performance doesn't guarantee future results, there's a very good chance the market will recover from even a severe recession and go on to see positive returns.

Why you should keep investing, according to Buffett

Even if you know the market will survive this downturn, it can be nerve-racking to continue throwing money into stocks when there's a chance prices could fall further. It's often tempting, then, to avoid investing until the market stabilizes.

However, that could potentially be a costly move. The market is forward-looking, which means it usually experiences turbulence ahead of the economy. If investors are concerned about a recession, stock prices will often fall well before the recession begins.

The opposite is also true, though. Once the worst is over, the market will often begin to recover before the economy shows signs of improvement. So if you're waiting to invest until the recession is over, you'll likely miss the early stages of the next bull market.

For this reason, Buffett encourages investors to keep buying even during the market's rough patches.

"I haven't the faintest idea as to whether stocks will be higher or lower a month or a year from now," he writes in the Times article. "What is likely, however, is that the market will move higher, perhaps substantially so, well before either sentiment or the economy turns up. So if you wait for the robins, spring will be over."

How to protect your money right now

Perhaps Buffett's best piece of advice is regarding where, exactly, to put your money. Not all stocks will survive a recession, and investing in the wrong places could be incredibly costly. The right investments, though, can save you during periods of volatility.

In Berkshire Hathaway's 2021 letter to shareholders, Buffett discussed his and business partner Charlie Munger's approach to choosing stocks.

"[W]e own stocks based upon our expectations about their long-term business performance and not because we view them as vehicles for timely market moves," he writes. "That point is crucial: Charlie and I are not stock-pickers; we are business-pickers."

The best stocks are the ones from healthy businesses with solid fundamentals, such as strong financials and a competent leadership team. These types of companies are far more likely to withstand downturns, and the more of these stocks you have in your portfolio, the better off you'll be.

Nobody -- not even Warren Buffett -- knows how the market will fare over the coming months, and there's a chance things will get worse before they get better. But they will get better. By sticking it out and continuing to invest during the low points, you'll reap the rewards when the market inevitably recovers.