Some real estate markets always do better than others, no matter what part of the cycle, and one factor is the attractiveness of individual metro areas as places to live. The quality of a place helps companies grow because they’re able to attract talented workers, which in turn spurs demand for space. It isn’t the only factor contributing to the health of a market, but it’s increasingly important as Millennials put more value on the experiential aspects of their lives.

WalletHub recently ranked the 62 largest U.S. cities in terms 31 metrics gauging the quality of a place, including measures of livability, health- and education-system quality, economic growth and tax burden. The company found that opportunity, both economic and personal, is the main driving force for most people coming into a particular metro. The tradeoff is limited square footage in the most successful markets.

Despite its notoriously high rents, San Francisco came out as the No. 1 best large city to live in, according to the ranking. It might be expensive, but residents are getting something for their money, especially a healthful place to live (No. 1) where residents enjoy high-quality educational opportunities (No. 3) and high overall livability (No. 9). Next on the overall scale were Seattle, Raleigh, N.C.,Colorado Springs, Denver, San Jose and Austin.

Surprisingly—and according to WalletHub—some highly livable places were down in the list, such as Chicago, Philadelphia, Indianapolis, San Antonio and even New York, which came in at No. 42. The lowest ranking metros on the list were Cleveland, Memphis and Detroit.