Power Query Problems

Create an Automated Loan Repayment Schedule in Excel Power Query

Phi Hung VoPhi Hung Vo Dec 2, 2026 868 views

Question details

Create a loan repayment schedule that calculates each month's balances, interest, and principal automatically.

Create an Automated Loan Repayment Schedule in Excel Power Query
Product
Microsoft Excel Power Query
Device & OS
not provided
Scenario
A loan has a fixed monthly payment and annual interest rate, and the user wants a schedule for the full year.
Observed behavior
Each month's closing balance should become the next month's opening balance, with interest and principal recalculated sequentially.
Before you start

Gather the starting loan balance, fixed monthly payment, and annual interest rate. Enter the rate as a decimal in Power Query, such as 0.08 for 8%, and confirm that monthly interest is calculated at one-twelfth of the annual rate.

Solution 1Recommended

Generate a 12-month schedule with Power Query

Use a blank query to calculate each month from the preceding month's closing balance.

The query uses List.Accumulate to build the rows sequentially. The sample values are illustrative; replace them with your loan details.

1
Create a blank query

In Excel, select Data > Get Data > From Other Sources > Blank Query. In the Power Query Editor, select Home > Advanced Editor.

2
Enter the schedule code

Replace the existing code with the following, then select Done: let InitialBalance = 100000, MonthlyPayment = 4500, AnnualRate = 0.08, Rows = List.Accumulate( {1..12}, {}, (state, month) => let opening = if List.IsEmpty(state) then InitialBalance else List.Last(state)[Closing Balance], interest = opening * AnnualRate / 12, principal = MonthlyPayment - interest, closing = opening - principal in state & {[Month = month, Opening Balance = opening, Payment = MonthlyPayment, Annual Rate = AnnualRate, Interest = interest, Principal = principal, Closing Balance = closing]} ), Schedule = Table.FromRecords(Rows) in Schedule

3
Set your loan values

In Home > Advanced Editor, replace InitialBalance, MonthlyPayment, and AnnualRate with your values. Change {1..12} if you need a different number of monthly rows.

4
Load the results

Select Home > Close & Load to place the schedule in Excel. To change the inputs later, edit the query and load it again.

Generate a 12-month schedule with Power Query
Check the final payment: This example applies the same payment for every row and does not cap the final payment. A balance can become negative if the loan is paid off before the schedule ends. If the payment is less than the monthly interest, the balance will increase.
Free Microsoft Office alternative

Build a loan schedule with WPS Spreadsheets

WPS Office is a free, lightweight alternative for working with loan schedules in a familiar spreadsheet interface. Open an Excel workbook and use cell formulas to calculate monthly interest, principal, and balances.

Calculate loan repayment rows with spreadsheet formulasOpen and edit Microsoft Excel XLSX files for easier migrationWork in a familiar spreadsheet interfaceUse a free, lightweight Office alternative
microsoft office alternative - wps office

Frequently Asked Questions

How is monthly interest calculated in the schedule?

Multiply the opening balance by the annual rate and divide by 12. For example, with an 8% annual rate, use Opening Balance × 0.08 / 12.

How does the next month get its opening balance?

In the Power Query example, List.Last(state)[Closing Balance] retrieves the previous row's closing balance. In the worksheet alternative, cell B8 refers to F7, and the reference advances when you fill the formula down.

Why does my closing balance become negative?

The fixed payment may exceed the remaining balance plus interest. The examples do not cap the final payment, so review and adjust that payment when the loan is paid off.

Can I create a schedule longer than one year?

Yes. In Power Query's Home > Advanced Editor, change {1..12} to the number of months you need, such as {1..24} for two years.

What happens if the payment is smaller than the monthly interest?

The principal calculation becomes negative, so the closing balance increases. Check the payment and interest rate inputs before relying on the schedule.