I'm trying to find a way to calculate the price of a home I can afford based on my potential downpayment, the monthly rent I can afford, and the interest of a potential loan.  I've seen questions like [this][1] and [this][2] and I've consulted other sites like [this][3], but I can't seem to find one with the home value as the output.

The structure I need is an equation that spits out a total home value (e.g. $800,000) with the following variables:

 - Monthly Mortgage Payment
 - Term of Loan
 - Interest Rate
 - Downpayment

I'm fine assuming it's a standard mortgage, but if there was a way I could try out different types (ARM, etc.) that would be a plus.

One issue: I know Excel has the PMT function, but I want to know what's happening, so I need it to be in basic, PEMDAS-able operations.

Can anyone lead me in the right direction?

  [1]: https://money.stackexchange.com/questions/48775/what-is-the-formula-for-loan-payoff-with-daily-compounded-interest-and-monthly-p
  [2]: https://money.stackexchange.com/questions/61639/what-is-the-formula-for-the-monthly-payment-on-an-adjustable-rate-mortgage
  [3]: https://www.wikihow.com/Calculate-Mortgage-Payments#Calculating_Mortgage_Payments_with_an_Equation_sub