English · Excel 與 CSV 匯入 ·
Import the Detail Lines or the Summary Row, Not Both
A payable sheet can carry invoice lines and a summary row that already adds those lines. The SUM function adds the values in a range [2]. If that range contains both the summary and the lines underneath it, the same dollars are added twice. The SUBTOTAL function ignores nested subtotals so they are not counted twice [1]. AGGREGATE option 0 ignores nested SUBTOTAL and AGGREGATE results for the same reason [3]. The import rule follows that arithmetic: classify every row, keep o
Import the Detail Lines or the Summary Row, Not Both
A payable sheet can carry invoice lines and a summary row that already adds those lines. The SUM function adds the values in a range [2]. If that range contains both the summary and the lines underneath it, the same dollars are added twice. The SUBTOTAL function ignores nested subtotals so they are not counted twice [1]. AGGREGATE option 0 ignores nested SUBTOTAL and AGGREGATE results for the same reason [3]. The import rule follows that arithmetic: classify every row, keep one level, and exclude the other.
The figures below are constructed. They are not client records. This is a bookkeeping practice note, not tax advice, and it does not file a return.
Step 1: Classify every row before any total is trusted
Read the sheet from top to bottom and label each row before you add anything.
| Row | What it says | Classification |
|---|---|---|
| 1 | Paper, invoice 1001, $120 | Detail |
| 2 | Paper, invoice 1002, $80 | Detail |
| 3 | Paper total, $200 | Summary of rows 1 and 2 |
| 4 | Ink, invoice 1003, $50 | Detail |
| 5 | "Adjusted paper", $40, no invoices listed under it | Unclassified |
A row is a summary only when the sheet shows which detail rows it adds. Row 3 qualifies: $120 + $80 = $200, and the label says it is the paper total. Row 5 does not qualify. It has an amount and a label, but no parent total and no child lines. It is not a detail line either, because no invoice number is attached.
Step 2: Keep one level and exclude the other
Import the detail lines: $120, $80, and $50. Exclude row 3 from the imported set. The excluded row stays on the sheet as a control figure. It is not deleted, and it is not given its own ledger line.
Importing row 3 together with rows 1 and 2 would post $200 of paper twice. A range that uses SUM on those three cells returns $400, because SUM adds each value it is given [2]. A nested SUBTOTAL does not do that: other subtotals inside its references are ignored to avoid double counting [1]. AGGREGATE with option 0 also ignores nested SUBTOTAL and AGGREGATE functions [3]. The bookkeeper's choice is the same choice those functions encode. Pick the detail level or the summary level. Do not post both.
The check against the excluded total
After the detail lines are selected, add only those lines and compare the sum with the excluded summary.
- Paper detail: $120 + $80 = $200. The excluded paper total is $200. Difference: $0. The paper block can be imported.
- Ink detail: $50. There is no ink summary row, so there is no second total to compare. The single invoice is the whole ink block.
- Imported amount if the stop row is left out: $250.
The check tests the import. It does not prove that the invoices are genuine, correctly priced, or in the right currency. A difference of $0 means the selected lines reproduce the summary. It does not mean the source documents have been reviewed.
If the detail sum were $190 against a paper total of $200, the check would fail. The next places to look are a missing line, a line entered twice, or a line that belongs to another category. Do not "fix" the $10 by typing it into an empty cell so the control passes. A plugged difference is a new amount with no source row.
The stop when a row has no class
Row 5 stops the import of the whole sheet, not only of that row. The rule is narrow: if a row cannot be classified as summary or detail, do not post any amount from the sheet until the row is resolved. Posting the clean blocks and skipping the odd row hides the fact that the sheet's grain is unfinished.
Resolution has to name a parent or a document:
- If $40 is a third paper invoice, give it an invoice number and include it in the paper detail. The paper control then changes, and the check must be run again.
- If $40 is another total, name the lines it adds. If those lines are already in the import, exclude $40. If they are not on the sheet, the total has nothing under it, and it still cannot be posted.
- If nobody can say which of those is true, the amount stays off the ledger. It is not an unapplied receipt, and it is not a write-off.
Zebra Audit stores that decision on one review line: the level kept, the rows excluded, the control difference, and any row that stopped the sheet. The name on the line is the worksheet, not a claim that a particular firm was observed, and not a ranking of products.
What this pass does not decide
This pass does not map column headers to ledger fields for the first time, and it does not decide whether a later file from the same sender may reuse a mapping that was already confirmed. Those are separate reviews. A sheet can have perfect headers and still double-count, because the header row does not tell you that row 3 is the sum of rows 1 and 2.
It also does not choose a currency treatment. If the $200 paper total were in one currency and the two invoices in another, the equality $120 + $80 = $200 would be a coincidence of numerals, not a control. Stop and separate the currencies before using the total.
Filtered rows are a further limit on the spreadsheet functions, and they are not a substitute for classification. SUBTOTAL always excludes rows that a filter has hidden, whichever function number is used [1]. AGGREGATE can also be set to ignore hidden rows and error values [3]. A filtered view can therefore omit a detail line that the summary still includes. Run the control on the unfiltered sheet. A total that matches only while a filter is on is not a passed check.
What to write on the review line
For the next sheet that contains both a summary and its lines, the review line should hold:
- The grain of one imported row, such as one invoice.
- The level kept, and the level left out.
- The control: summary figure, sum of the kept rows, and the difference.
- Every derived amount, marked as derived. A figure computed as "total minus one category" is not a source row.
- Any unclassified row, the point at which the sheet stopped, and what document or parent total later resolved it.
- Whether the comparison was made on the full sheet or on a filtered view [1][3].
Until item 5 is empty or resolved, the sheet is not ready to post. A zero control difference on the classified blocks does not override an unclassified row.