Create a Complete Report in Excel with Just One Formula

Jan 30, 2025 • 7 min read

One formula, one cell, one result? Those days are long gone. With dynamic arrays, we can build an entire Excel report from a single formula, including headings, calculations, and a total row.

We are going to use a loan repayment schedule as our example. Three inputs will drive the whole report: the loan amount, the number of monthly repayments, and the annual interest rate. Change an input, and the report updates. Change the number of repayments, and the report grows or shrinks automatically.

But the loan schedule is only the example. The useful part is understanding how to build individual calculations, give them names with LET, and assemble them into one dynamic result. Once that process makes sense, you can apply it to your own reports.

What You'll Learn

  • Build and test individual dynamic array calculations before combining them into one report formula.
  • Use LET to name inputs and reuse calculated arrays within a single formula.
  • Combine columns with HSTACK and report sections with VSTACK so totals move automatically.
  • Apply conditional formatting based on the Total label so styling follows the resized report.

Set Up the Report Inputs

Start with these three parameters:

  • C3: Loan amount.
  • C4: Number of monthly repayments.
  • C5: Annual interest rate.

The report will start in B8 and contain five columns: Period, Opening, Interest, Payment, and Closing.

Rather than trying to write the complete formula immediately, we will build and check each calculation separately. That makes the logic much easier to follow.

Build the Individual Report Calculations

1. Create the headings with an array constant

In B8, enter:

={"Period","Opening","Interest","Payment","Closing"}

The curly brackets create an array constant. This formula spills the five headings across a single row, from B8 to F8.

Because the headings will always occupy the first row of the report, we can format that row directly. Select B8:F8, make the text bold with Ctrl+B, and add a bottom border. In Excel for Windows, the ribbon key sequence for a bottom border is Alt, H, B, O.

2. Generate the period numbers with SEQUENCE

In B9, enter:

=SEQUENCE(C4)

SEQUENCE creates a list starting at 1, with the number of rows specified in C4. If C4 contains 12, the result is a vertical list from 1 to 12.

We will use this list to calculate the interest for every repayment period.

3. Calculate monthly interest with IPMT

In D9, enter:

=IPMT(C5/12,B9#,C4,-C3)

The arguments connect to our inputs and period list:

  • C5/12: Converts the annual interest rate to a monthly rate.
  • B9#: Supplies the entire list of period numbers.
  • C4: Supplies the total number of repayments.
  • -C3: Uses the negative loan amount as the present value, giving positive interest amounts.

The # symbol is important. B9 refers to one cell, but B9# refers to the entire spill range starting at B9. This lets one IPMT formula calculate interest for all periods.

As repayments reduce the loan balance, the interest charged each month reduces too.

4. Repeat the monthly payment down an array

The monthly payment calculation is:

=PMT(C5/12,C4,C3)

Unlike our interest calculation, PMT returns a single value here. However, the report needs that payment repeated for every period.

To achieve that, enter this formula in E9:

=SEQUENCE(C4,1,PMT(C5/12,C4,C3),0)

This SEQUENCE formula creates:

  • The number of rows specified in C4.
  • One column.
  • A starting value equal to the monthly payment.
  • A step of zero.

A sequence with a step of zero repeats the same value. That gives us a payment array with exactly the same number of rows as the period and interest arrays.

Using the positive loan amount in PMT produces negative payments. That sign convention will help us calculate the remaining balance: interest adds to the loan, while payments reduce it.

5. Calculate closing balances with SCAN

In F9, enter:

=SCAN(C3,D9#+E9#,SUM)

SCAN produces a running calculation. Here, it begins with the loan amount in C3 and accumulates each month's net movement.

The expression D9#+E9# adds the positive interest amount to the negative payment amount for each period. SUM then adds that movement to the running balance.

The result is a list of closing balances, showing the loan reducing until it is fully repaid.

6. Create opening balances with VSTACK and DROP

Each period's opening balance is the previous period's closing balance. The first period is the exception: it starts with the original loan amount.

In C9, enter:

=DROP(VSTACK(C3,F9#),-1)

VSTACK places the original loan amount above the closing balance array. That shifts the closing balances down by one position.

However, it also gives us one more row than we need. DROP removes the final row using -1, leaving an opening balance for every period.

7. Add a total row with HSTACK

For the initial 12-period layout, enter this formula in B21:

=HSTACK("Total","",SUM(D9#),SUM(E9#),"")

HSTACK joins the five pieces horizontally:

  • The label Total.
  • An empty text string under Opening.
  • Total interest.
  • Total payments.
  • An empty text string under Closing.

The empty strings keep the total row five columns wide, matching the headings and report body.

For now, make the total row bold and add a top border. The Windows ribbon key sequence for a top border is Alt, H, B, P.

Why Separate Spill Formulas Are Not Enough

All the calculations are working, but the report is not fully dynamic yet.

Change the number of repayments from 12 to 8, and the calculation arrays shrink. The total row, however, stays in row 21, leaving a gap.

Change the number of repayments to 16, and the arrays need to expand into the total row. Because those cells already contain a formula, Excel returns #SPILL! errors.

The solution is to make the headings, body, and total row parts of the same spilled result. Then the total row will always sit immediately below the final repayment.

Combine the Report into One LET Formula

Name the three inputs

Use an empty area of the worksheet to build the combined formula. We can start in H8 while keeping the original calculations available for reference.

Begin with:

=LET(
loan,C3,
months,C4,
rate,C5,
0
)

LET assigns names to values and calculations within a formula. Here, loan represents C3, months represents C4, and rate represents C5.

The last argument is the result LET returns. For now, zero is just a placeholder.

Use Alt+Enter while editing the formula to insert line breaks. Separating the calculations onto their own lines makes a longer formula much easier to read.

Bring in the individual calculations

Next, create a named calculation for each part of the report. Copy the formulas we have already tested, remove their leading equals signs, and replace worksheet references with the appropriate names.

  • title: The array containing the five column headings.
  • period: The SEQUENCE calculation, using months instead of C4.
  • interest: The IPMT calculation, using rate, period, months, and loan.
  • payment: The repeated PMT calculation.
  • closing: The SCAN calculation, using loan, interest, and payment.
  • opening: The DROP and VSTACK calculation, using loan and closing.
  • total: The HSTACK calculation, summing interest and payment.

Notice that the spill references disappear. Inside LET, period already represents the complete period array, so there is no need to reference B9#.

The same applies to interest, payment, and closing. Each name holds the result we need for later calculations.

Assemble the body, headings, and totals

First, join the five report columns horizontally:

HSTACK(period,opening,interest,payment,closing)

Then place the headings above that body and the total row below it:

VSTACK(title,HSTACK(period,opening,interest,payment,closing),total)

This becomes LET's final argument, replacing the zero placeholder.

The complete single-formula report

Here is the complete formula:

=LET(
loan,C3,
months,C4,
rate,C5,
title,{"Period","Opening","Interest","Payment","Closing"},
period,SEQUENCE(months),
interest,IPMT(rate/12,period,months,-loan),
payment,SEQUENCE(months,1,PMT(rate/12,months,loan),0),
closing,SCAN(loan,interest+payment,SUM),
opening,DROP(VSTACK(loan,closing),-1),
total,HSTACK("Total","",SUM(interest),SUM(payment),""),
VSTACK(title,HSTACK(period,opening,interest,payment,closing),total)
)

Boom! The entire report now comes from one formula.

Excel worksheet showing the original repayment schedule on the left and a second spilled schedule on the right
The combined formula produces the same report as the separate calculations.

Once the combined formula is working, copy its formula text, clear the original report formulas and their results, and enter the combined formula in B8. Clear the temporary formula in H8 as well.

The report now spills from B8, including its total row. When the number of periods changes, every part moves together.

Make the Total Row Formatting Dynamic

There is one final detail. The calculations resize automatically, but manually applied cell formatting stays where we put it.

If the total row moves, its bold text and border do not follow automatically. We need conditional formatting to identify the total row by its content rather than its position.

  1. Clear the old manually applied total-row formatting.
  2. Select a range covering columns B:F, starting at row 8 and extending beyond the largest report you expect to create.
  3. Go to Home > Conditional Formatting > New Rule.
  4. Choose Use a formula to determine which cells to format.
  5. Enter the formula below.
  6. Set the format to bold text with a top border, then confirm the dialogs.
=$B8="Total"

The dollar sign locks the check to column B. The row number remains relative, so Excel checks column B on each row of the selected range.

Whenever column B contains Total, the formatting applies across that row within the selected range.

The total row is now identified by what it contains, not where it happens to be.

Test the Report and Reuse the Process

Change C4 to 8, then 12, then 16. The period list, interest, payments, opening balances, closing balances, and total row should all resize together. The conditional formatting should follow the Total label.

Changing the loan amount or interest rate updates the calculations too.

The broader technique is straightforward:

  1. Build and check the individual calculations.
  2. Give inputs and calculated arrays meaningful names with LET.
  3. Use HSTACK to assemble columns and VSTACK to assemble report sections.
  4. Use conditional formatting for styling that needs to move with the results.

You do not need this exact loan repayment schedule to benefit from the approach. The important shift is to think of a report as a collection of arrays that can be calculated, named, and combined. One formula can return the whole result.

Share

Excel Off The Grid

I help you reduce repetitive Excel work with practical guides to formulas, Power Query, reporting, and automation.

© 2026 Excel Off The Grid
Powered by Convella