A simple formula that can help you choose whether to repair or replace.

Americans are paying more to keep their vehicles in shipshape condition. In fact, the cost of maintaining a car increased by about 11% over the past year, to nearly a nickel per mile for the average sedan, according to industry research. That’s $500 for every 10,000 miles, and another $100 for tires.

In addition, of course, there’s the time commitment: You have to service your car for regular maintenance, oil changes, tire rotations, as well as spend hours getting it waxed and polished to make sure its coat is clean and protected.

But what happens when your ride starts costing much more than a few hundred dollars a year? When the next major maintenance and/or repair comes with a multi-thousand dollar price tag? How do you know whether to pay up—or trade it in for an entirely new vehicle?

The bad news: There is no bulletproof formula to follow. For example, if you get hit with a $3,000 bill for a failed transmission, you could be tempted to trade it in—which would be a good decision in some cases. However, that repair would still be less expensive than a decent used car. And if you buy brand new, your insurance and registration fees may increase, while the value of the purchase immediately plunges once you drive it out of the dealership.

Fortunately, in the absence of a “sure thing” formula, there are general guidelines to follow: First of all, check your receipts to find out how much you’ve spent on car maintenance over the last year. Then, figure out how much you would pay over a year for a monthly loan on a new or new-to-you used model.

Ultimately, it’s time to take the plunge if the cost of auto repairs equals 12 monthly payments, according to automotive expert Steve Porter, who runs the site, MyAutoRepairAdvice.com.

“If you’re spending more between maintenance and repairs than you would to buy another car, that’s when enough is enough,” Porter says. “Also, if you ever have a repair that’s even close to what the car is currently worth, it’s time to get another one.”