Basic에서 PMT 및 PPMT 재무 함수 예제

만료된 KB 콘텐츠 고지 사항

이 문서는 Microsoft에서 더 이상 지원하지 않는 제품에 대해 작성되었습니다. 따라서 이 문서는 “있는 그대로" 제공되며 더 이상 업데이트되지 않습니다.

요약

이 프로그램에서는 PMT 및 PPMT의 재무 함수를 사용 하는 방법을 보여 줍니다. PMT 투자 정기 지급액을 반환합니다. 대출금의 경우 PMT 일정 한 이율을, 총 지불 및 대출 금액 (현재 가치) 기준으로 대출 상수 매월 상환액 (총 주 + 이자)의 크기를 반환 합니다.


PPMT 투자 지정된 된 기간에 대 한 주 상환액입니다. (PMT PPMT-지정된 된 기간에 이자를 지불입니다.) 대출 기간 동안 반환 된 모든 PPMT 값의 합계가 대출 금액입니다.

자세한 내용

아래 나열 된 구입 및 집을 판매 하는 것에 대 한 재무 분석이입니다. 집 구입 및 판매 된 후 매달 평균 지분 향상 프로그램을 반환 합니다. 단순화 된 확장 효과 포함 하 여 다양 한 시나리오를 기꺼이 초기 매개 변수 (예: houseval, rate1, sellper, apprec 등 아래로)를 변경할 수 있습니다. 한 달 음수 net 지분 향상 돈을;에 보내는 한 달 양수 net 지분 향상 수입입니다.


줄어드는 판매 집과 당기 순이익을 비교 하거나 한 달의 현재 숙소 상황에 outgo 시간을 선택할 수 있습니다.

코드 예제

' To try this example in VBDOS.EXE:' 1. From the File menu, choose New Project.
' 2. Copy the code example to the Code window.
' 3. Press F5 to run the program.

' To run this program in the environment, you must invoke the
' environment with the /L switch to load the default Quick library:
' VBDOS.EXE /L FINANCE.QLB for Visual Basic 1.0 for MS-DOS
' QBX /L FINANCER.QLB for Basic PDS 7.0 for MS-DOS
' To run outside the QBX.EXE environment, you must link with the
' appropriate library (FINANCER.LIB, FINANCAR.LIB, FINANCEP.LIB, or
' FINANCAP.LIB).

REM $INCLUDE: 'FINANCE.BI'

DEFDBL A-Z

' Initialize variables:
CLS
houseval = 110000# ' Purchase price of house (median for Seattle).
apprec = 1.07# ' Assumed yearly appreciation rate of house.
sellper = 10# * 12# ' Period (month) at which you choose to sell.
down = .1# ' Fraction of houseval paid as down payment.
equity = down * houseval ' Initial equity in house (10% down payment).
pv1 = (1 - down) * houseval 'Present value of loan = 90% of houseval.
rate1 = .1025# / 12 ' Loan interest rate (10.25%) divided by 12 months.
pool = 0 ' Pool of money, if any, to earn interest & subtract payments.
poolint = 1.0057# ' Monthly interest earned on pool to get 7% yearly.
pointsbuy = .02# ' Assumed fees to buy loan, as fraction of houseval.
pointsell = .07# ' Selling fees (points) as fraction of selling price.
per = 0# ' Month (period) counter.
nper1 = 360# ' # periods in loan. 30-year loan has 360 months.
ptype% = 0# ' 0 means payment due at end of each period.
fv1 = 0# ' Future value (the goal) of a loan is always zero.
ptot1 = 0# ' Current total of principal paid towards loan.
in = .95# ' 1 minus the inflation rate.
proptax = -130# ' Property taxes per month (tax deductible).
fire = -25# ' Fire/house insurance per month.
roommate = 400# ' Rent income from roommate (0 if none) after taxes.
roominflate = 1.02 ' Yearly rate you increase your roommate's rent.
tax = .8# ' 1 minus your average yearly Tax rate (as a fraction).
initial = pool + equity
PRINT "Purchase price ="; houseval;
PRINT " // Initial pool + equity = "; initial
upfront = equity + (pointsbuy * houseval)
PRINT "Up front cost (down payment + loan fees) ="; upfront

' Calculate monthly (principal+interest) payment:
payment1 = Pmt(rate1, nper1, pv1, fv1, ptype%, Status%)
IF down < .2# THEN
minsure = .03 * payment1 ' Monthly mortgage insurance rate (3% of
ELSE ' principal+interest payment). You usually must pay
minsure = 0# ' mortgage insurance if you paid < 20% down.
END IF
PRINT "monthly payment= "
PRINT payment1; "+"; fire; "+"; proptax; "+"; minsure; "= ";
PRINT payment1 + fire + proptax + minsure
PRINT "not counting tax savings ("; 1 - tax; "factor ) ";
PRINT "or roommate income ("; roommate; ")";
PRINT "**************************************************"

' Add up numbers until the period (month) where you sell (sellper):
FOR j = 1 TO sellper
per = j
' Yearly rent increase:
IF j MOD 12 = 0 THEN roommate = roominflate * roommate

' Calculate principal and interest amounts paid:
principal1 = PPmt(rate1, per, nper1, pv1, fv1, ptype%, Status%)

ptot1 = ptot1 + principal1 ' Total accumulated principal to date.
interest1 = payment1 - principal1
itot1 = itot1 + interest1 'Total accumulated interest paid to date.
' Outaftertax1 and outgo values are negative:
outaftertax1 = ((interest1 + proptax) * tax) + principal1 + fire
+ minsure
pool = pool + outaftertax1 + roommate ' (outaftertax is negative).
' Pool earns interest if positive (no interest charged if negative,
' assuming you make monthly house payments without borrowing):
IF pool > 0 THEN pool = pool * poolint
equity = equity + ABS(principal1) ' Monthly principal builds equity.
NEXT

' Calculate final appreciation and closing costs; and print out:
years = sellper / 12# ' Number of years after which you sold.
aphouseval = houseval * (apprec ^ years) ' Appreciated house value.
closecost = -(pointsbuy * houseval) - (pointsell * aphouseval)
naphouseval = aphouseval - houseval ' Net appreciation on house value.
final = pool + equity + naphouseval + closecost
in1989 = final * (in ^ years) ' In 1989 dollars (inflation adjusted).
PRINT
PRINT "After"; years; " years, buy+sell closecost ="; closecost
PRINT "total principal paid="; ptot1 + ptot2
PRINT "total interest paid="; itot1 + itot2
PRINT "Appreciated value of house = "; aphouseval
PRINT "final pool+equity+apprec-close="; final
PRINT "or"; in1989; " in 1989 dollars with"; 1 - in; "yearly inflation"
PRINT "(which is a"; CSNG(in ^ years); " overall inflation factor)"
PRINT
PRINT "Net ave. equity increase per month="; (final - initial)
/ sellper
PRINT "(or with inflation="; (in1989 - initial) / sellper;
"in 1989 dollars)"

속성

문서 ID: 52070 - 마지막 검토: 2017. 2. 7. - 수정: 1

피드백