Get the local build — $9
summarymerging

Summing a column that lives in twelve files

Three ways to add up numbers spread across workbooks: linked formulas, manual entry, or merge-then-group. Only one of them still gives the right answer after someone renames a file — and only one of them tells you why the total looks wrong.

Why linked formulas are a trap

=SUM('C:\reports\[2024-01.xlsx]Sheet1'!D2:D500) works until the file moves, is renamed, or is closed in a way Excel dislikes — then the cell shows #REF! or, worse, the last cached value. A workbook full of external links is slow to open and impossible to audit, because the numbers depend on files you cannot see.

Manual entry is accurate once and wrong forever: next month someone adds a file and nobody updates the total.

Merge, then group — and get more than a total

Stack every file into one sheet (columns matched by name, source column kept), clean the measure column so the values are numbers, then group by whatever dimension you care about: account, store, month, rep.

You get count, total, average, min, max and share per group in one pass. The average must be computed over rows that actually have a value — dividing the total by the row count understates it whenever some cells are blank, which in real exports is most of the time.

Reconcile, always

The merged grand total must equal the sum of the per-file totals. If it does not, a file was skipped or merged twice, and sorting by the source column shows you which within seconds. This one check catches nearly every cross-file summing error, including your own output file being picked up as input on the next run.

Step by step

  1. Put every file in one folder and merge into a single sheet, keeping the source-file column.
  2. Clean the measure column: strip currency symbols and thousands separators, parse to numbers.
  3. Compare the count of numeric cells with the count of non-empty cells — the gap is your problem list.
  4. Group by the dimension and sum; add count, average, min, max and share.
  5. Reconcile the grand total against the sum of the per-file totals before using the number.

The command, concretely

python sheetkit.py merge ./statements -o all.xlsx
python sheetkit.py report all.xlsx --group-by Month --sum Amount

month    count      total      avg      min       max    share
2024-01     41  20,356.10   496.49   120.00  1,980.00  28.62%
2024-02     38  16,120.00   424.21   210.00  1,410.00  22.67%
2024-03     35  14,880.50   425.16   180.00  1,220.00  20.92%
---------------------------------------------------------------
total      180  71,118.80   395.10

What goes wrong

A column that sums to zero

Every cell is text — a currency symbol, a trailing space, or a thousands separator. SUM ignores text silently. Clean first, then the total appears.

Blank cells dragging the average down

Average over rows that have a value, not over all rows. A file where half the amount cells are empty will otherwise halve the mean.

Counting a total row as data

An export that ends with a Total row doubles the grand total once merged. Drop rows whose first cell is a total label before summing.

Questions people actually ask

Can I sum across files without merging?

With linked formulas, yes, but they break when files move and they are slow. For a recurring job, merging is more work once and less work forever.

How do I sum only some rows?

Filter before grouping, or group by the extra dimension — grouping by store and month gives you every slice without a second pass.

Does it handle hundreds of files?

Yes — the merge is linear in total rows. Hundreds of files of a few thousand rows is tens of seconds; the slow part is opening the result in Excel.

Do it now, in this browser

Drop the folder in, check the detected header, merge. Nothing is uploaded — the file is processed in the tab. Free for one-off merges; the unlimited local build is $9.