Millennials were more likely than any other generation to flee the stock market during last year’s rout. That meant they were also more likely to miss out on the subsequent rally.

Those were the results of a survey released Monday by Ernst & Young’s wealth management unit, which found that nearly half of millennial respondents turned to cash amid the market volatility. By comparison, just 34% of Gen X and 24% of Baby Boomers sought safety in cash.

The survey of more than 2,600 clients was conducted from October to November, right around the time the stock market bottomed. Since its low on Oct. 12, the S&P 500 Index has jumped about 16%.

Despite the stock rally, cash is increasingly in vogue. Vehicles like high-yield savings accounts, money market funds and certificates of deposit are offering attractive returns for the first time in years amid the Federal Reserve’s aggressive rate-hike campaign.

Goldman’s popular high-yield Marcus account recently upped its rate to 3.9%.

Still, there’s plenty of debate over whether those products can compete against inflation and the stock market. There’s also downside to pulling money from stocks: JPMorgan Asset Management data show that investors who were absent for the S&P 500’s 10 best days in the two decades through 2022 received half the gains of those who were in the market for the entire period.

Baby Boomers are more likely than millennials to work closely with a financial adviser, which may have encouraged them to stay invested during the market volatility, said Mike Lee, leader of EY Global Wealth & Asset Management. They may also have a stronger stomach for market swings after watching past market recoveries, including the rebound after the 2008 financial crisis, he said.

EY Global Wealth & Asset Management found that more clients may flock to cash. “If volatility continues, a greater proportion of clients (43%) would further increase their exposure to savings and deposits,” the report said.

The survey used the following age definitions: Millennials (21-41), Gen X (42-57) and Baby Boomers (58 and over).

This article was provided by Bloomberg News.