Why the raw export won’t pivot
Send a Transaction Detail by Account report to Excel and you get a faithful copy of the printed report, not a table:
- Letterhead first. The company name, report title and date range take up the first three rows, and the real headings start on row 4.
- The hierarchy lives in the indentation. A top-level account such as
4000 · Revenuesits in one column, its sub-accounts one column to the right, and a third level one further. The transaction rows leave those columns empty, so a row on its own doesn’t say which account it belongs to. - Totals in the middle of the data. A
Total …row closes every account and a grandTOTALsits at the bottom. Leave them in a pivot and the amounts are counted again.
The fix is to put the account on every transaction row, throw away everything that isn’t a transaction, and hand Excel a plain table. The steps below do exactly that.
Step 1: Export the report with the right settings
- In QuickBooks Desktop, go to Reports › Accountant & Taxes › Transaction Detail by Account. A memorized report built on it works too.
- Pick the date range. Year to date is fine.
- Customize Report › Display: tick Type, Date, Num, Name, Memo, Debit and Credit. Debit and Credit need to be separate columns rather than a single Amount column. Balance is optional.
- Customize Report › Header/Footer: keep Company Name and Report Title ticked.
- Leave the accounts indented the way QuickBooks shows them. That indentation is what tells you the account levels.
- Click Excel › Create New Worksheet and choose in new workbook. Under Advanced, untick Send header to Page Setup in Excel, so the company name and report title stay in cells A1 and A2.
- Save the workbook as Excel Workbook (.xlsx).
Step 2: Find the heading row and the account label columns
Open the export and look at its layout before you write any formulas. In the example used on this page it looks like this:
| Where | What’s there |
|---|---|
| Rows 1–3, column A | Company name, report title, date range |
| Row 4 | The headings: Type, Date, Num, Name, Memo, Debit, Credit, Balance (columns E to L) |
| Column B | Top-level accounts, e.g. 4000 · Revenue, and their Total … rows |
| Column C | Sub-accounts, e.g. 4010 · Retail Sales, and their Total … rows |
| Column D | A third level, if your chart of accounts has one |
| Last rows, column A | The grand TOTAL |
Your file may not match letter for letter. QuickBooks sometimes leaves narrow empty columns between the headings, and a chart of accounts with fewer levels uses fewer label columns. Note your own heading row and column letters, and adjust the formulas in the next step to match.
Step 3: Add helper columns that carry each account down
In the first empty columns to the right of the report (M onward in the example), type these headings in row 4 and these formulas in row 5. Then copy the formulas down to the last row of the report.
| Column | Heading (row 4) | Formula (row 5, copied down) |
|---|---|---|
| M | Category | =IF(B5="",M4,IF(LEFT(B5,6)="Total ","",B5)) |
| N | Sub-account | =IF(M5<>M4,"",IF(C5="",N4,IF(LEFT(C5,6)="Total ","",C5))) |
| O | Sub-sub-account | =IF(N5<>N4,"",IF(D5="",O4,IF(LEFT(D5,6)="Total ","",D5))) |
| P | Account | =IF(O5<>"",O5,IF(N5<>"",N5,M5)) |
| Q | Net Amount | =K5-J5 |
How they work:
- Category repeats the last label found in column B, and clears when it reaches that account’s
Totalrow. - Sub-account does the same for column C, and starts again whenever the category changes, so a sub-account never leaks into the next category. Sub-sub-account does the same for column D, one level down.
- Account is the deepest level the line actually sits in. A line posted straight to a parent account gets the parent’s name, so nothing is lost.
- Net Amount is credit less debit, so income comes out positive and expenses negative. Use
=J5-K5instead if you’d rather see debits as positive.
If your accounts only go two levels deep, leave out Sub-sub-account and use =IF(N5<>"",N5,M5) for Account. If they go four deep, add one more column in the same pattern.
Step 4: Keep only the transaction rows
- Select row 4 and turn on Data › Filter.
- Open the filter arrow on Type and untick (Blanks). The letterhead, the account headings, every
Totalrow and the grandTOTALhave an empty Type, so only real transactions stay visible. - Select the visible rows from the heading row down and copy them. Excel copies only the rows the filter shows.
- On a new sheet, click A1 and use Home › Paste › Paste Values, so the formulas become fixed text and numbers.
- Delete the old label columns (A–D in the example) and the Balance column. Balance is a running balance, so adding it up in a pivot gives a meaningless number.
Step 5: Check that dates and amounts are real dates and numbers
Excel exports from QuickBooks Desktop usually arrive with real dates and numbers, but check before you pivot. Dates and numbers line up on the right of the cell by default, and text lines up on the left. If a column has come through as text, select it and run Data › Text to Columns › Finish to convert it in place. Blank Debit or Credit cells are fine.
Step 6: Turn the range into an Excel table
Click anywhere in the data, press Ctrl+T and confirm My table has headers. Then, on the Table Design tab, change the table name to something like Transactions. A table grows when you paste more rows under it, and a PivotTable built on it picks up the new rows when refreshed.
Step 7: Insert the PivotTable and check it against QuickBooks
- With a cell in the table selected, choose Insert › PivotTable and put it on a new worksheet.
- Drag Category and then Account into Rows. Add Name under them if you want to see payees.
- Drag Debit, Credit and Net Amount into Values.
- Drag Type into Filters, so you can look at just invoices or just cheques.
- If a value shows as “Count of…”, click it, choose Value Field Settings and pick Sum. Excel picks Count when a column contains blanks or text.
Check the result
Before you rely on the pivot, compare it with the original export. For each account, the pivot’s Debit and Credit should equal that account’s Total row in the QuickBooks report. If an account is out, the usual causes are a label column copied down too far or not far enough, or a filter that let a Total row through.
Doing this every month
The method works, but it’s manual: column letters can shift between exports, the formulas have to be copied down again, and every new month or client means another round of filter, copy and paste values. Keep a blank copy of your helper columns so you can paste them into the next export, and always run the totals check above.
The shortcut
If you rebuild these exports every month, LedgerCleaner is a Windows 10/11 app we make that does these steps for you. It reads the indentation, drops the letterhead and Total rows, and writes one workbook with five sheets: Pivot, Quarters, Summary, Transactions and Sources. Account subtotals and the grand total reconcile with the Total rows QuickBooks printed. It reads QuickBooks Desktop exports only (not QuickBooks Online), and the PivotTables need desktop Excel for Windows.
Questions
Does this work with a QuickBooks Online export?
Not as written. QuickBooks Online lays out its similar-sounding report differently: headings such as Transaction Type and Memo/Description, usually a single Amount column instead of Debit and Credit, and the account hierarchy shown as group rows rather than indented label columns. The formulas above are for the QuickBooks Desktop layout.
Why are some Sub-account cells blank?
Because that line was posted to the parent account itself rather than to one of its sub-accounts. The Account column repeats the parent, so the line still lands in the right place in the pivot.
Why does my pivot say “Count of Debit”?
Excel defaults to Count when a column contains blanks or text, and Debit and Credit always have blanks. Change it with Value Field Settings › Sum. If it still looks wrong, some amounts may be text: see step 5.
Can I keep the Balance column?
You can keep it in the table for reference, but don’t put it in the pivot’s Values. It’s a running balance, so summing it adds the same money up many times.