Ever gotten excited about a house for sale, then looked at the price and thought, “Are they out of their minds?” Yeah, us too.

It can be a disheartening moment when you’re house hunting. And that jaw-dropping asking price might simply seem like an arbitrary, money-grabbing number that’s keeping you from your dream home. But before you dismiss a house for being too expensive, you should know that there are a variety of reasons a property is priced the way it is.

“Pricing a home is part science and part art,” says Kevin Vitali, an associate broker with Exit Group One Real Estate, in Tewksbury, MA.

Understanding the reasoning behind a home’s price tag can make you a smarter buyer—and help you know exactly what you’re getting for your money. Here are five factors that experienced real estate agents consider before slapping that “For Sale” sign on a home.

1. What’s happening in your local housing market at any particular moment

Current real estate market conditions—including how many houses are up for sale, and how fast they’re being snapped up—determine how a property should be priced. Low inventory creates a seller’s market with aggressive listing prices. A surplus of homes for sale results in overall lower asking prices.

Perhaps you know all that. But what you might not realize is how quickly it can all change.

“Markets can turn on a dime, and I find home buyers usually have old data in their heads; often, they’re lagging about six months to a year,” Vitali says.

That’s why he recommends working with an experienced real estate agent who’s familiar with the neighborhood you’re shopping in and can assess whether a home is priced fairly—or not.

2. The (extremely specific) location of the house

Yes, you’ve heard the old place-based adage (which we won’t repeat here). But did you know how granular the idea of “location” gets? We’re not just talking about being in a good neighborhood….