WalletHub looked at 150 of the most populated U.S. cities to figure out the best (and worst) places to raise a family. In Arizona, Scottsdale fared extremely well.

Using data from the U.S. Census Bureau, Bureau of Labor Statistics, and National Center for Education Statistics, 41 metrics were weighted by importance and then averaged across each city. Those cities ranking closest to 100 points are considered highly favorable for homeowners with families. The metrics were categorized across five dimensions (Family Fun, Health & Safety, Education & Child Care, Affordability, and Socio-economics).

Scottsdale came in 20th overall, scoring 61.58 points out of a possible 100. The Valley city scored high in Affordability and Socio-economics, entering the top ten in both categories. It also had a strong Health & Safety score, which helped offset a poorer showing in both Family Fun and Education & Child Care.

Right behind Scottsdale was Gilbert, which came in 23rd overall with a score of 60.91. It actually scored better than Scottsdale in terms of Health and Safety but fared much lower in Family Fun and Education & Child Care.

Also showing up in the rankings were Chandler (No. 34), Peoria (No. 41), Tempe (No. 101), Mesa (No. 103), Phoenix (No. 114), Glendale (No. 129), and Tucson (No. 131). Affordability was the category where the state shone the brightest with three cities landing in the top five (Scottsdale, Gilbert, Chandler).