How to prepare a trial balance in Excel

A general ledger can run to thousands of lines. With a few formulas, a spreadsheet turns it into a trial balance: one row per account, debit and credit balances, and a check that the two columns agree. Here is how, step by step.

What you are building

A trial balance lists every account with its balance, debits in one column and credits in the other. Because every journal entry has equal debits and credits, the column totals must agree. If the idea is new, start with trial balance practice, which builds one by hand from T-accounts.

In a spreadsheet, the starting point is usually a ledger export: one row per posting, with a date, an account name, and an amount in either a Debit or a Credit column. Your job is to summarize it by account. Three tools do almost all the work:

The MO-220 objective this covers

This lesson is MO-220 practice for the objective "Prepare a trial balance", under "Organize financial data with formulas": using math, statistical, logical and lookup functions on accounting data. MO-220 task instructions describe the purpose of a calculation, such as "show each account's total debits", rather than naming the function to use. So the skill being tested is choosing the right function from the task's wording. The exercises here are worded the same way. Accounting Exercises is not affiliated with Microsoft or Certiport.

The worksheet layout

Here is Northside Print Shop's February 2026 ledger, as it appears in the free exercise. Every entry is two lines: one debit and one credit.

RowA: DateB: AccountC: DebitD: Credit
42/4/2026Rent Expense3,250.00
52/4/2026Cash3,250.00
62/4/2026Accounts Receivable3,790.00
72/4/2026Service Revenue3,790.00
82/6/2026Cash10,500.00
92/6/2026Owner's Capital10,500.00
102/6/2026Accounts Receivable2,800.00
112/6/2026Service Revenue2,800.00
122/8/2026Cash16,500.00
132/8/2026Owner's Capital16,500.00
142/11/2026Cash4,055.00
152/11/2026Service Revenue4,055.00
162/15/2026Rent Expense800.00
172/15/2026Cash800.00
182/24/2026Supplies1,115.00
192/24/2026Accounts Payable1,115.00
202/26/2026Cash640.00
212/26/2026Accounts Receivable640.00

The account list sits in H4:H10 (Cash, Accounts Receivable, Supplies, Accounts Payable, Owner's Capital, Service Revenue, Rent Expense), with "Total" in H11. Your formulas go in columns I and J.

Step 1: total debits and credits by account

For Cash, you want the sum of column C, but only on rows where column B says "Cash". That is a conditional sum. In I4:

=SUMIFS($C$4:$C$21,$B$4:$B$21,H4)

Read it as: add up C4:C21 where B4:B21 equals the account name in H4. For credits, change only the column being added. In J4:

=SUMIFS($D$4:$D$21,$B$4:$B$21,H4)

The dollar signs lock the ledger ranges. The criterion H4 has none, so when you fill the two formulas down to row 10 it becomes H5, H6 and so on, while the ledger stays put. Finally, total both columns in row 11 with =SUM(I4:I10) and =SUM(J4:J10).

RowH: AccountI: Total debitsJ: Total credits
4Cash31,695.004,050.00
5Accounts Receivable6,590.00640.00
6Supplies1,115.000.00
7Accounts Payable0.001,115.00
8Owner's Capital0.0027,000.00
9Service Revenue0.0010,645.00
10Rent Expense4,050.000.00
11Total43,450.0043,450.00

Check one by hand: Cash debits are 10,500.00 + 16,500.00 + 4,055.00 + 640.00 = 31,695.00. Both columns total 43,450.00, so every posting was picked up.

Step 2: turn totals into balances

A true trial balance shows each account's net balance in one column. Cash, for example, is 31,695.00 − 4,050.00 = 27,645.00, a debit balance. Service Revenue is a 10,645.00 credit balance.

The third exercise asks for exactly this, on a different ledger (Juniper Landscaping, July). The Debit balance column subtracts credits from debits and keeps the result only if it is positive:

=MAX(SUMIFS($C$4:$C$21,$B$4:$B$21,H4)-SUMIFS($D$4:$D$21,$B$4:$B$21,H4),0)

The Credit balance column does the reverse:

=MAX(SUMIFS($D$4:$D$21,$B$4:$B$21,H4)-SUMIFS($C$4:$C$21,$B$4:$B$21,H4),0)

MAX(…,0) returns the larger of the difference and zero. A debit-balance account shows its balance in I and 0 in J; a credit-balance account the other way round. For Juniper, Cash shows 19,330.00 in I and 0 in J, while Service Revenue shows 0 in I and 8,710.00 in J. Both columns total 29,080.00.

RowH: AccountI: Debit balanceJ: Credit balance
4Cash19,330.000.00
5Accounts Receivable480.000.00
6Supplies1,370.000.00
7Accounts Payable0.001,370.00
8Owner's Capital0.0019,000.00
9Service Revenue0.008,710.00
10Rent Expense7,900.000.00
11Total29,080.0029,080.00

Accounts Receivable is a good one to check by hand. Juniper billed customers 820.00, 2,240.00 and 2,980.00, a total of 6,040.00, and collected 5,560.00. The balance is 6,040.00 − 5,560.00 = 480.00, a debit, so it appears in column I.

Step 3: add a balance check

A good worksheet tells you when something is wrong. In I12:

=IF(ROUND(I11-J11,2)=0,"In balance","Out of balance")

ROUND(…,2) compares the totals to the cent. Spreadsheets store decimals in binary, so two totals that print as equal can differ by a tiny fraction. Rounding the difference first stops a false "Out of balance".

Step 4: look up each account's type

The second exercise adds a chart of accounts in L4:N10 (account, type, normal balance) and asks for each ledger line's type in column E. The solution uses an exact-match lookup:

=XLOOKUP(B4,$L$4:$L$10,$M$4:$M$10)

It finds the account name from B4 in column L and returns the matching value from column M, such as Asset or Revenue. XLOOKUP matches exactly by default. With a type column, you can filter or sort the ledger by type, or total by type with another conditional sum.

Why formulas beat typing the numbers

You could add up each account with a calculator and type the results in. For eighteen lines, that works. For a real month, it doesn't, and typed numbers go stale the moment someone posts a correction. A formula-driven trial balance in Microsoft® Excel® spreadsheets updates itself: change a ledger amount and every total, balance and the status cell follow.

Formulas also make your work auditable. A reviewer can click any balance and see exactly which range and which account name produced it. That is much easier to check than a number with no history.

The MO-220 objective also covers organizing the transactions themselves. Sorting the ledger by account, or filtering it to one account, is a quick way to confirm a single SUMIFS result by eye before you trust the whole column.

Common mistakes

Ranges that shift when you fill down

If I4 is written as =SUMIFS(C4:C21,B4:B21,H4), filling it down moves the ledger too: by row 10 it reads C10:C27 and misses the first rows. For Northside, Rent Expense then shows 800.00 instead of 4,050.00, and Service Revenue credits show 6,855.00 instead of 10,645.00. Lock the ranges: $C$4:$C$21.

Totaling credits from the Debit column

Copying the debit formula into column J without changing C to D makes the credits repeat the debits. The totals still agree at 43,450.00, so the check alone won't catch it. Credits come from column D.

Approximate-match lookups

An older lookup such as VLOOKUP with TRUE as its last argument expects a sorted table. This chart isn't sorted, so some lines come back with the wrong type. Ask for an exact match.

Returning the wrong column

Returning column N gives "Debit" or "Credit", the normal balance, instead of the type. Return column M.

Gross totals instead of net balances

Showing total debits and total credits for each account isn't a trial balance. For Juniper, Cash would show 27,230.00 and 7,900.00 instead of a single 19,330.00 debit balance, and the totals would be 42,540.00 instead of 29,080.00.

Negative numbers in the other column

Without MAX, Cash's credit column would show −19,330.00. Every account then nets to zero across the row, and both totals become 0, so the check says "In balance" while the trial balance is meaningless. Show 0, not a negative.

Related topics

Once the trial balance is in balance, its figures feed financial ratios in Excel. For the journal entries behind each ledger line, see journal entry practice problems.

Frequently asked questions

Which Excel function is best for a trial balance?

A conditional sum such as SUMIFS does most of the work: it totals the debit or credit column for each account name. MAX and IF help turn the totals into balances and check them.

Why use dollar signs in the SUMIFS formula?

They make the ledger ranges absolute, so the formula can be filled down without the ranges moving. Only the account-name criterion should change from row to row.

Why round before comparing the totals?

Decimal amounts can carry tiny binary rounding differences. Rounding the difference to two places compares the totals to the cent.

Does a balanced trial balance mean the ledger is correct?

No. Errors such as a wrong account or a missing entry can leave the totals equal. It proves the ledger is arithmetically in balance, nothing more.

What if an account in my list doesn't appear in the ledger?

SUMIFS simply returns 0 when nothing matches, so the account shows 0.00 in both columns. If an account you expected to have activity shows zero, check that its name is spelled exactly the same in the ledger and in your account list, including spaces and apostrophes.

Is this the same as the MO-220 exam?

No. These are original MO-220 practice tasks on the same skills, written by Accounting Exercises, not exam questions. The free exercise below gives you a new ledger each time.

Practice it now: Trial balance

A free exercise with new numbers every time. No sign-up.

Start the free exercise