There's no place like home — except when you can't afford one.

Millennials have been priced out of some of the biggest U.S. cities, with residential real estate prices rising even as wage growth remains elusive. 

Bloomberg used data from the U.S. Census Bureau, Zillow Group Inc. and to quantify how much more money millennials would need to earn each year to afford a home in the largest U.S. cities. The good news is that out of 50 metropolitan areas, 37 are actually affordable for the typical 18-34 year-old.

The bad news is that the areas that often most appeal to young adults are also the ones where homeownership is the most out of reach.

The biggest disparities are on the West Coast. Take the three Californian hubs of San Francisco, San Jose (the heart of Silicon Valley), and Los Angeles (where a developer is trying to sellone of the biggest homes in U.S. history for a record $500 million). The typical young adult in those cities doesn't even make half of what's needed to afford a home. 

That makes places such as New York, where millennials have an earnings gap of just $6,550, seem relatively affordable. But remember that New York's metropolitan statistical region includes places that are outside of the high-priced housing market in and around Manhattan, where $374,350 (the median home value for the metro area) wouldn't even buy you a kitchen.

Almost 80 percent of New York's millennials reside in three counties: New York County, Queens County and Kings County, where Manhattan, Queens and Brooklyn respectively are located. Using the average median home value for those three boroughs ($749,596) and the 2015 estimated earnings for millennials living there ($49,193), the affordability gap comes out to a whopping $52,262.

Furthermore, Bloomberg's calculations assume that millennials have already saved up the 20 percent they'd need for a down payment, which is a problem in itself. Families where the head of household was under 35 years old had a median net worth of $10,400 in 2013, according to the Federal Reserve'sSurvey of Consumer Finances.

Many millennials "don't have the money for a down payment or can't afford to buy where they want to buy," said Mark Vitner, senior economist at Wells Fargo Securities LLC in Charlotte, North Carolina. "It's tougher to buy a home in the city."

That means millennials living in unaffordable markets will be forced to shell out money for ever-increasing rents, instead of building equity.