vb6parse 1.0.0

vb6parse is a library for parsing and analyzing VB6 code, from projects, to controls, to modules, and forms.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="VB6Parse Library Reference - ipmt - Financial">
    <title>ipmt - Financial - VB6Parse Library Reference</title>
    <link rel="stylesheet" href="../../../assets/css/style.css">
    <link rel="stylesheet" href="../../../assets/css/docs-style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css">
    <script src="../../../assets/js/theme-switcher.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/vbnet.min.js"></script>
    <script>hljs.highlightAll();</script>
</head>
<body>
    <header class="docs-header">
        <div class="container">
            <h1><a href="../../../index.html">VB6Parse</a> / <a href="../../../library/index.html">Library</a> / <a href="../../../library/functions/financial/index.html">Financial</a> / ipmt</h1>
            <p class="tagline">VB6 Library Reference</p>
        </div>
    </header>

    <nav class="docs-nav">
        <div class="container">
            <a href="../../../index.html">Home</a>
            <a href="../../../library/index.html">Library Reference</a>
            <a href="../../../documentation.html">Documentation</a>
            <a href="https://docs.rs/vb6parse" target="_blank">API Docs</a>
            <a href="https://github.com/scriptandcompile/vb6parse" target="_blank">GitHub</a>
            <button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
                <span class="theme-icon">🌙</span>
            </button>
        </div>
    </nav>

    <main class="container">
        
        <article class="library-item">
            <h1 id="ipmt-function">IPmt Function</h1>
<p>Returns a <code>Double</code> specifying the interest payment for a given period of an annuity based on periodic, fixed payments and a fixed interest rate.</p>
<h2 id="syntax">Syntax</h2>
<pre><code class="language-vbnet">IPmt(rate, per, nper, pv[, fv[, type]])</code></pre>
<h2 id="parameters">Parameters</h2>
<ul>
<li><code>rate</code> (Required): <code>Double</code> specifying interest rate per period. For example, if you get a car loan at an annual percentage rate (APR) of 10 percent and make monthly payments, the rate per period is 0.1/12, or 0.0083</li>
<li><code>per</code> (Required): <code>Double</code> specifying payment period in the range 1 through nper</li>
<li><code>nper</code> (Required): <code>Double</code> specifying total number of payment periods in the annuity. For example, if you make monthly payments on a four-year car loan, your loan has 4 * 12 (or 48) payment periods</li>
<li><code>pv</code> (Required): <code>Double</code> specifying present value, or value today, of a series of future payments or receipts. For example, when you borrow money to buy a car, the loan amount is the present value to the lender of the monthly car payments you will make</li>
<li><code>fv</code> (Optional): <code>Variant</code> specifying future value or cash balance you want after you've made the final payment. For example, the future value of a loan is $0 because that's its value after the final payment. However, if you want to save $50,000 over 18 years for your child's education, then $50,000 is the future value. If omitted, 0 is assumed</li>
<li><code>type</code> (Optional): <code>Variant</code> specifying when payments are due. Use 0 if payments are due at the end of the payment period, or use 1 if payments are due at the beginning of the period. If omitted, 0 is assumed</li>
</ul>
<h2 id="return-value">Return Value</h2>
<p>Returns a <code>Double</code> representing the interest payment for the specified period:
- Negative value indicates money paid out (such as loan interest payments)
- Positive value indicates money received (such as investment interest earnings)
- The sum of interest payments (<code>IPmt</code>) and principal payments (<code>PPmt</code>) equals the total payment for a period</p>
<h2 id="remarks">Remarks</h2>
<p>An annuity is a series of fixed cash payments made over a period of time:
- Used to calculate the interest portion of a specific payment
- Commonly used for loan amortization calculations
- Interest payment decreases over the life of a loan (more principal paid later)
- The <code>per</code> argument must be in the range 1 through <code>nper</code>
- <code>rate</code> and <code>nper</code> must be calculated using payment periods in the same units
- For monthly payments, divide annual rate by 12, multiply years by 12
- For quarterly payments, divide annual rate by 4, multiply years by 4
- All arguments referring to cash paid out are negative; cash received is positive
- The interest payment varies by period (unlike fixed total payment)
- Use <code>PPmt</code> to calculate the principal portion of a payment
- Use <code>Pmt</code> to calculate the total payment amount</p>
<h2 id="typical-uses">Typical Uses</h2>
<ol>
<li><strong>Loan Amortization</strong>: Calculate interest portion of loan payments</li>
<li><strong>Mortgage Analysis</strong>: Determine interest paid per payment period</li>
<li><strong>Investment Analysis</strong>: Calculate interest earned per period</li>
<li><strong>Financial Planning</strong>: Project interest expenses over time</li>
<li><strong>Tax Calculations</strong>: Determine deductible interest for tax purposes</li>
<li><strong>Budget Planning</strong>: Forecast interest costs</li>
<li><strong>Refinancing Analysis</strong>: Compare interest costs between loans</li>
<li><strong>Amortization Schedules</strong>: Build payment schedules showing interest breakdown</li>
</ol>
<h2 id="basic-usage-examples">Basic Usage Examples</h2>
<pre><code class="language-vbnet">&#x27; Example 1: Calculate first month&#x27;s interest on a car loan
Dim monthlyRate As Double
Dim totalMonths As Integer
Dim loanAmount As Double
Dim interestPayment As Double
monthlyRate = 0.08 / 12  &#x27; 8% annual rate
totalMonths = 48         &#x27; 4-year loan
loanAmount = -20000      &#x27; $20,000 borrowed (negative = cash received)
interestPayment = IPmt(monthlyRate, 1, totalMonths, loanAmount)
Debug.Print &quot;First month interest: &quot; &amp; Format$(interestPayment, &quot;Currency&quot;)
&#x27; Prints approximately: -$133.33
&#x27; Example 2: Calculate last payment&#x27;s interest
interestPayment = IPmt(monthlyRate, 48, totalMonths, loanAmount)
Debug.Print &quot;Last month interest: &quot; &amp; Format$(interestPayment, &quot;Currency&quot;)
&#x27; Prints approximately: -$3.26 (much less than first month)
&#x27; Example 3: Calculate total interest paid in first year
Dim totalInterest As Double
Dim i As Integer
totalInterest = 0
For i = 1 To 12
    totalInterest = totalInterest + IPmt(monthlyRate, i, totalMonths, loanAmount)
Next i
Debug.Print &quot;First year interest: &quot; &amp; Format$(totalInterest, &quot;Currency&quot;)
&#x27; Example 4: Monthly mortgage interest payment
Dim mortgageRate As Double
Dim mortgageMonths As Integer
Dim mortgageAmount As Double
mortgageRate = 0.06 / 12  &#x27; 6% annual rate
mortgageMonths = 30 * 12  &#x27; 30-year mortgage
mortgageAmount = -200000  &#x27; $200,000 loan
interestPayment = IPmt(mortgageRate, 1, mortgageMonths, mortgageAmount)
Debug.Print &quot;First mortgage payment interest: &quot; &amp; Format$(interestPayment, &quot;Currency&quot;)</code></pre>
<h2 id="common-patterns">Common Patterns</h2>
<pre><code class="language-vbnet">&#x27; Pattern 1: Calculate interest for specific payment
Function CalculateInterestPayment(loanAmount As Double, annualRate As Double, _
                                  years As Integer, paymentNumber As Integer) As Double
    Dim monthlyRate As Double
    Dim totalPayments As Integer
    monthlyRate = annualRate / 12
    totalPayments = years * 12
    CalculateInterestPayment = IPmt(monthlyRate, paymentNumber, totalPayments, -loanAmount)
End Function
&#x27; Pattern 2: Calculate total interest for a year
Function CalculateAnnualInterest(loanAmount As Double, annualRate As Double, _
                                 years As Integer, year As Integer) As Double
    Dim monthlyRate As Double
    Dim totalPayments As Integer
    Dim startMonth As Integer
    Dim endMonth As Integer
    Dim totalInterest As Double
    Dim i As Integer
    monthlyRate = annualRate / 12
    totalPayments = years * 12
    startMonth = (year - 1) * 12 + 1
    endMonth = year * 12
    totalInterest = 0
    For i = startMonth To endMonth
        If i &lt;= totalPayments Then
            totalInterest = totalInterest + IPmt(monthlyRate, i, totalPayments, -loanAmount)
        End If
    Next i
    CalculateAnnualInterest = totalInterest
End Function
&#x27; Pattern 3: Generate amortization schedule entry
Type AmortizationEntry
    PaymentNumber As Integer
    TotalPayment As Double
    InterestPayment As Double
    PrincipalPayment As Double
    Balance As Double
End Type
Function GetAmortizationEntry(loanAmount As Double, annualRate As Double, _
                              years As Integer, paymentNumber As Integer) As AmortizationEntry
    Dim monthlyRate As Double
    Dim totalPayments As Integer
    Dim entry As AmortizationEntry
    monthlyRate = annualRate / 12
    totalPayments = years * 12
    entry.PaymentNumber = paymentNumber
    entry.TotalPayment = Pmt(monthlyRate, totalPayments, -loanAmount)
    entry.InterestPayment = IPmt(monthlyRate, paymentNumber, totalPayments, -loanAmount)
    entry.PrincipalPayment = PPmt(monthlyRate, paymentNumber, totalPayments, -loanAmount)
    GetAmortizationEntry = entry
End Function
&#x27; Pattern 4: Compare interest costs between loans
Function CompareInterestCosts(loan1Amount As Double, loan1Rate As Double, loan1Years As Integer, _
                              loan2Amount As Double, loan2Rate As Double, loan2Years As Integer) As String
    Dim loan1Interest As Double
    Dim loan2Interest As Double
    Dim i As Integer
    &#x27; Calculate total interest for loan 1
    For i = 1 To loan1Years * 12
        loan1Interest = loan1Interest + IPmt(loan1Rate / 12, i, loan1Years * 12, -loan1Amount)
    Next i
    &#x27; Calculate total interest for loan 2
    For i = 1 To loan2Years * 12
        loan2Interest = loan2Interest + IPmt(loan2Rate / 12, i, loan2Years * 12, -loan2Amount)
    Next i
    CompareInterestCosts = &quot;Loan 1 total interest: &quot; &amp; Format$(loan1Interest, &quot;Currency&quot;) &amp; vbCrLf &amp; _
                          &quot;Loan 2 total interest: &quot; &amp; Format$(loan2Interest, &quot;Currency&quot;)
End Function
&#x27; Pattern 5: Calculate deductible interest for tax year
Function CalculateTaxDeductibleInterest(loanAmount As Double, annualRate As Double, _
                                       totalYears As Integer, taxYear As Integer) As Double
    &#x27; Assumes loan started at beginning of year 1
    CalculateTaxDeductibleInterest = CalculateAnnualInterest(loanAmount, annualRate, totalYears, taxYear)
End Function
&#x27; Pattern 6: Determine when interest drops below threshold
Function FindPaymentWhenInterestBelow(loanAmount As Double, annualRate As Double, _
                                      years As Integer, threshold As Double) As Integer
    Dim monthlyRate As Double
    Dim totalPayments As Integer
    Dim i As Integer
    Dim interestPayment As Double
    monthlyRate = annualRate / 12
    totalPayments = years * 12
    For i = 1 To totalPayments
        interestPayment = Abs(IPmt(monthlyRate, i, totalPayments, -loanAmount))
        If interestPayment &lt; threshold Then
            FindPaymentWhenInterestBelow = i
            Exit Function
        End If
    Next i
    FindPaymentWhenInterestBelow = -1  &#x27; Never drops below threshold
End Function
&#x27; Pattern 7: Calculate average monthly interest
Function CalculateAverageMonthlyInterest(loanAmount As Double, annualRate As Double, _
                                         years As Integer) As Double
    Dim totalInterest As Double
    Dim totalPayments As Integer
    Dim i As Integer
    totalPayments = years * 12
    For i = 1 To totalPayments
        totalInterest = totalInterest + IPmt(annualRate / 12, i, totalPayments, -loanAmount)
    Next i
    CalculateAverageMonthlyInterest = totalInterest / totalPayments
End Function
&#x27; Pattern 8: Interest payment with balloon payment
Function CalculateInterestWithBalloon(loanAmount As Double, annualRate As Double, _
                                      years As Integer, paymentNumber As Integer, _
                                      balloonAmount As Double) As Double
    Dim monthlyRate As Double
    Dim totalPayments As Integer
    monthlyRate = annualRate / 12
    totalPayments = years * 12
    CalculateInterestWithBalloon = IPmt(monthlyRate, paymentNumber, totalPayments, _
                                        -loanAmount, -balloonAmount)
End Function
&#x27; Pattern 9: Interest for payment due at beginning
Function CalculateInterestPaymentBeginning(loanAmount As Double, annualRate As Double, _
                                           years As Integer, paymentNumber As Integer) As Double
    Dim monthlyRate As Double
    Dim totalPayments As Integer
    monthlyRate = annualRate / 12
    totalPayments = years * 12
    &#x27; Type = 1 means payment at beginning of period
    CalculateInterestPaymentBeginning = IPmt(monthlyRate, paymentNumber, totalPayments, _
                                             -loanAmount, 0, 1)
End Function
&#x27; Pattern 10: Validate interest payment calculation
Function ValidateInterestPayment(loanAmount As Double, annualRate As Double, _
                                 years As Integer, paymentNumber As Integer) As Boolean
    Dim totalPayment As Double
    Dim interestPayment As Double
    Dim principalPayment As Double
    Dim monthlyRate As Double
    Dim totalPayments As Integer
    monthlyRate = annualRate / 12
    totalPayments = years * 12
    totalPayment = Pmt(monthlyRate, totalPayments, -loanAmount)
    interestPayment = IPmt(monthlyRate, paymentNumber, totalPayments, -loanAmount)
    principalPayment = PPmt(monthlyRate, paymentNumber, totalPayments, -loanAmount)
    &#x27; Verify that interest + principal = total payment (within rounding tolerance)
    ValidateInterestPayment = (Abs(totalPayment - (interestPayment + principalPayment)) &lt; 0.01)
End Function</code></pre>
<h2 id="advanced-usage-examples">Advanced Usage Examples</h2>
<pre><code class="language-vbnet">&#x27; Example 1: Complete amortization schedule generator
Public Class AmortizationSchedule
    Private m_loanAmount As Double
    Private m_annualRate As Double
    Private m_years As Integer
    Private m_schedule As Collection
    Public Sub Initialize(loanAmount As Double, annualRate As Double, years As Integer)
        m_loanAmount = loanAmount
        m_annualRate = annualRate
        m_years = years
        GenerateSchedule
    End Sub
    Private Sub GenerateSchedule()
        Dim monthlyRate As Double
        Dim totalPayments As Integer
        Dim i As Integer
        Dim entry As AmortizationEntry
        Dim balance As Double
        Set m_schedule = New Collection
        monthlyRate = m_annualRate / 12
        totalPayments = m_years * 12
        balance = m_loanAmount
        For i = 1 To totalPayments
            entry.PaymentNumber = i
            entry.TotalPayment = Pmt(monthlyRate, totalPayments, -m_loanAmount)
            entry.InterestPayment = IPmt(monthlyRate, i, totalPayments, -m_loanAmount)
            entry.PrincipalPayment = PPmt(monthlyRate, i, totalPayments, -m_loanAmount)
            balance = balance - entry.PrincipalPayment
            entry.Balance = balance
            m_schedule.Add entry
        Next i
    End Sub
    Public Function GetPayment(paymentNumber As Integer) As AmortizationEntry
        If paymentNumber &gt;= 1 And paymentNumber &lt;= m_schedule.Count Then
            GetPayment = m_schedule(paymentNumber)
        End If
    End Function
    Public Function GetTotalInterest() As Double
        Dim i As Integer
        Dim total As Double
        Dim entry As AmortizationEntry
        For i = 1 To m_schedule.Count
            entry = m_schedule(i)
            total = total + entry.InterestPayment
        Next i
        GetTotalInterest = total
    End Function
End Class
&#x27; Example 2: Loan comparison calculator
Public Class LoanComparer
    Public Function CompareLoanOptions(loanAmount As Double) As String
        Dim result As String
        Dim option1Interest As Double
        Dim option2Interest As Double
        Dim option3Interest As Double
        Dim i As Integer
        result = &quot;Loan Amount: &quot; &amp; Format$(loanAmount, &quot;Currency&quot;) &amp; vbCrLf &amp; vbCrLf
        &#x27; Option 1: 15-year at 5.5%
        For i = 1 To 15 * 12
            option1Interest = option1Interest + IPmt(0.055 / 12, i, 15 * 12, -loanAmount)
        Next i
        result = result &amp; &quot;15-year at 5.5%: &quot; &amp; Format$(option1Interest, &quot;Currency&quot;) &amp; vbCrLf
        &#x27; Option 2: 20-year at 6.0%
        For i = 1 To 20 * 12
            option2Interest = option2Interest + IPmt(0.06 / 12, i, 20 * 12, -loanAmount)
        Next i
        result = result &amp; &quot;20-year at 6.0%: &quot; &amp; Format$(option2Interest, &quot;Currency&quot;) &amp; vbCrLf
        &#x27; Option 3: 30-year at 6.5%
        For i = 1 To 30 * 12
            option3Interest = option3Interest + IPmt(0.065 / 12, i, 30 * 12, -loanAmount)
        Next i
        result = result &amp; &quot;30-year at 6.5%: &quot; &amp; Format$(option3Interest, &quot;Currency&quot;)
        CompareLoanOptions = result
    End Function
End Class
&#x27; Example 3: Interest payment tracker
Public Class InterestTracker
    Private m_loanAmount As Double
    Private m_annualRate As Double
    Private m_years As Integer
    Private m_currentPayment As Integer
    Public Sub Initialize(loanAmount As Double, annualRate As Double, years As Integer)
        m_loanAmount = loanAmount
        m_annualRate = annualRate
        m_years = years
        m_currentPayment = 0
    End Sub
    Public Function GetNextInterestPayment() As Double
        m_currentPayment = m_currentPayment + 1
        If m_currentPayment &lt;= m_years * 12 Then
            GetNextInterestPayment = IPmt(m_annualRate / 12, m_currentPayment, _
                                         m_years * 12, -m_loanAmount)
        Else
            GetNextInterestPayment = 0
        End If
    End Function
    Public Function GetInterestForPayment(paymentNumber As Integer) As Double
        If paymentNumber &gt;= 1 And paymentNumber &lt;= m_years * 12 Then
            GetInterestForPayment = IPmt(m_annualRate / 12, paymentNumber, _
                                        m_years * 12, -m_loanAmount)
        Else
            GetInterestForPayment = 0
        End If
    End Function
    Public Function GetYearToDateInterest() As Double
        Dim currentYear As Integer
        Dim startMonth As Integer
        Dim endMonth As Integer
        Dim total As Double
        Dim i As Integer
        currentYear = Int((m_currentPayment - 1) / 12) + 1
        startMonth = (currentYear - 1) * 12 + 1
        endMonth = m_currentPayment
        For i = startMonth To endMonth
            total = total + IPmt(m_annualRate / 12, i, m_years * 12, -m_loanAmount)
        Next i
        GetYearToDateInterest = total
    End Function
End Class
&#x27; Example 4: Refinancing analyzer
Function AnalyzeRefinancing(currentLoanBalance As Double, currentRate As Double, _
                           remainingYears As Integer, newRate As Double, _
                           newYears As Integer, closingCosts As Double) As String
    Dim currentTotalInterest As Double
    Dim newTotalInterest As Double
    Dim i As Integer
    Dim result As String
    &#x27; Calculate remaining interest on current loan
    For i = 1 To remainingYears * 12
        currentTotalInterest = currentTotalInterest + _
            IPmt(currentRate / 12, i, remainingYears * 12, -currentLoanBalance)
    Next i
    &#x27; Calculate total interest on new loan
    For i = 1 To newYears * 12
        newTotalInterest = newTotalInterest + _
            IPmt(newRate / 12, i, newYears * 12, -currentLoanBalance)
    Next i
    result = &quot;Current loan interest: &quot; &amp; Format$(currentTotalInterest, &quot;Currency&quot;) &amp; vbCrLf
    result = result &amp; &quot;New loan interest: &quot; &amp; Format$(newTotalInterest, &quot;Currency&quot;) &amp; vbCrLf
    result = result &amp; &quot;Closing costs: &quot; &amp; Format$(closingCosts, &quot;Currency&quot;) &amp; vbCrLf
    result = result &amp; &quot;Net savings: &quot; &amp; _
             Format$(currentTotalInterest - newTotalInterest - closingCosts, &quot;Currency&quot;)
    AnalyzeRefinancing = result
End Function</code></pre>
<h2 id="error-handling">Error Handling</h2>
<p>The <code>IPmt</code> function can raise errors:
- <strong>Invalid procedure call (Error 5)</strong>: If <code>per</code> is less than 1 or greater than <code>nper</code>
- <strong>Type Mismatch (Error 13)</strong>: If arguments are not numeric
- <strong>Overflow (Error 6)</strong>: If result exceeds Double range</p>
<pre><code class="language-vbnet">On Error GoTo ErrorHandler
Dim interestPayment As Double
interestPayment = IPmt(0.08 / 12, 1, 48, -20000)
Debug.Print &quot;Interest payment: &quot; &amp; Format$(interestPayment, &quot;Currency&quot;)
Exit Sub
ErrorHandler:
    MsgBox &quot;Error calculating interest: &quot; &amp; Err.Description, vbCritical</code></pre>
<h2 id="performance-considerations">Performance Considerations</h2>
<ul>
<li><strong>Calculation Intensity</strong>: <code>IPmt</code> involves complex financial calculations</li>
<li><strong>Loop Performance</strong>: Calculating all payments can be slow for long-term loans</li>
<li><strong>Caching</strong>: Consider caching amortization schedules rather than recalculating</li>
<li><strong>Precision</strong>: Uses <code>Double</code> precision for accurate financial calculations</li>
</ul>
<h2 id="best-practices">Best Practices</h2>
<ol>
<li><strong>Consistent Periods</strong>: Ensure rate and nper use same time units (monthly, quarterly, etc.)</li>
<li><strong>Sign Convention</strong>: Use negative for cash paid, positive for cash received</li>
<li><strong>Validate Period</strong>: Check that <code>per</code> is between 1 and <code>nper</code></li>
<li><strong>Error Handling</strong>: Wrap financial calculations in error handlers</li>
<li><strong>Rounding</strong>: Round currency values appropriately for display</li>
<li><strong>Documentation</strong>: Document assumptions about payment timing (beginning/end of period)</li>
<li><strong>Testing</strong>: Verify that <code>IPmt</code> + <code>PPmt</code> = <code>Pmt</code> for each period</li>
</ol>
<h2 id="platform-and-version-notes">Platform and Version Notes</h2>
<ul>
<li>Available in all VB6 versions</li>
<li>Part of VBA financial functions</li>
<li>Uses <code>Double</code> precision (not Currency type)</li>
<li>Consistent with Excel's <code>IPMT</code> function</li>
<li>Sign convention follows financial standards</li>
</ul>
<h2 id="limitations">Limitations</h2>
<ul>
<li>Does not handle variable interest rates</li>
<li>Assumes constant payment amounts</li>
<li>Does not account for fees or other charges</li>
<li>Limited to fixed annuity calculations</li>
<li>No built-in support for skip payments or extra payments</li>
</ul>
<h2 id="related-functions">Related Functions</h2>
<ul>
<li><code>PPmt</code>: Principal payment for a period</li>
<li><code>Pmt</code>: Total payment for a period</li>
<li><code>Rate</code>: Interest rate per period</li>
<li><code>NPer</code>: Number of periods</li>
<li><code>PV</code>: Present value</li>
<li><code>FV</code>: Future value</li>
</ul>
        </article>
        
        <div style="margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border-color);">
            <p>
                <a href="index.html">← Back to Financial</a> |
                <a href="../index.html">View all functions</a>
            </p>
        </div>

    </main>

    <footer>
        <div class="container">
            <p>&copy; 2024-2026 VB6Parse Contributors. Licensed under the MIT License.</p>
        </div>
    </footer>
</body>
</html>