Two changes, confirmed with the user via concrete preview mockups
before building (avoiding a third wrong guess on the subtotal
structure after the account-grouping change):
- Reverted subtotal/heading grouping from Account back to Category
(bold subtotal row per category, sorted alphabetically; within a
category, detail rows sorted by account number then strategic area
then full project code). Account still shows as the full unsplit
"code:name" string on every detail row - that part of the account
change stays, only the grouping key reverted.
- The two uploaded trial balance files are now embedded as their own
sheets ("Revenue TB", "Expense TB") in the generated workbook, and
every Category Summary/Balance Sheet cell is a live formula against
them rather than a precomputed number - directly modeled on
"1. Summary (Manual)"/"Balance Sheet (FS)"'s own SUMIFS/SUMIF
formulas:
- Category Summary detail rows: SUMIFS matching Account+Category+
Project against the embedded sheet (blank category/project use ""
criteria, mirroring the template's ISBLANK(...) branches).
- Balance Sheet lines: SUMIF per mapped account code, wildcard-
matched ("<code>:*") since the sheet stores code+name together.
Totals (Total Current Assets, Total Assets, etc.) are formulas
summing the line-item cells above them, not baked-in numbers.
- Unrestricted (Net Assets) adds a live cross-sheet reference to
Category Summary's own Total Revenue/Total Expenses cells for the
period's Net Income, instead of a Python-computed literal.
All formulas use only SUM/SUMIF/SUMIFS - no Excel-only functions -
so the workbook is Google Sheets compatible, not just Excel.
Verified far more rigorously than a cross-check against my own Python
computation this time: wrote a SUMIFS/SUMIF simulator that evaluates
every formula against the actual embedded sheet data (not a
side-channel recomputation), recursively resolving subtotals, grand
totals, and the Balance Sheet's cross-sheet reference. Every result
matches exactly: revenue 5,338,866.02 / expense 3,743,572.26 /
surplus 1,595,293.76 / balance_check 0.00.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>