excel-subtotal-audit
What it does
This skill is a method for checking an Excel report after it is made, to confirm the totals include the right rows. It is for people who make financial or summary spreadsheets with subtotals.
When to use it
- ✓When I have generated a spreadsheet that contains subtotal or total formulas.
- ✓When some sections have blank, hidden or filtered rows that may affect the totals.
- ✓When a file opens fine but I still need to know the numbers are correct.
Skill link
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/excel-subtotal-audit/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“I generated a report with subtotals. Please read it back and confirm that every subtotal includes all the detail rows in its section.”
5 new skills a week. 1 minute to read.
How it works
The AI reads the finished workbook, prints each populated row including its formulas, identifies the subtotal rows, and checks that each formula covers the intended detail range.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Excel Subtotal Audit
Use this workflow after generating or modifying an Excel report to catch silent spreadsheet defects that simple file-exists or sheet-exists checks will miss.
The core idea is:
- Read back the finished workbook.
- Print every populated output row, including formulas.
- Identify section subtotal rows.
- Independently verify that each subtotal formula includes all visible detail rows intended for that section.
- Treat any mismatch as a report defect, even if the workbook opens successfully and looks formatted correctly.
This is especially useful for generated financial statements, operational summaries, rollups, grouped exports, and any worksheet where formulas summarize nearby detail rows.
When to use
Use this skill when:
- You generate Excel workbooks programmatically.
- The workbook contains subtotal, total, or rollup formulas.
- Sections may contain blank rows, hidden rows, filtered rows, or varying detail lengths.
- A mistake in a formula range would produce a plausible but wrong spreadsheet.
- Basic validation only checks whether the file was created, whether sheets exist, or whether formulas are present.
Goal
Do not stop at "the report was written successfully."
Instead, prove that:
- every expected output row is present,
- formulas were written into the intended cells,
- each subtotal references the correct detail range,
- no visible detail rows are omitted from the subtotal span.
Workflow
1. Save the workbook, then reopen it for audit
Always audit the workbook after writing it, using a fresh read from disk if possible. This verifies the actual persisted artifact rather than in-memory assumptions.
Checklist:
- Save workbook.
- Reopen workbook from disk.
- Select the target worksheet.
- Use formula view or raw formulas, not only calculated values.
Why: a writer may have inserted the wrong range, overwritten cells, or shifted rows during formatting.
2. Enumerate every populated row in the output region
Print a row-by-row audit log of all populated rows in the report area.
For each row, print:
- row number,
- displayed labels or key identifiers,
- numeric cells,
- raw formulas for formula cells,
- whether the row is hidden, if your library exposes that,
- any grouping/outline level if relevant.
This creates a human- and machine-inspectable trace of what the generator actually produced.
Minimum row audit format
A useful printed line looks like:
- Row 12: ["Revenue", 1250, "=SUM(B8:B11)"]
- Row 13: hidden ["Adjustment", 25, ""]
- Row 14: ["Total Revenue", "", "=SUM(B8:B13)"]
The exact format does not matter as much as consistency and inclusion of formulas.
What counts as populated
A row is populated if at least one relevant output cell contains:
- a value,
- a string label,
- a formula,
- formatting that corresponds to a semantic output row you need to validate.
Prefer auditing a defined report column range rather than the entire sheet.
3. Locate subtotal rows explicitly
Identify rows that represent subtotals, totals, or section summaries.
Common signals:
- a label like "Subtotal", "Total", "Net", "Gross", "Section Total",
- a formula in a numeric column,
- bold or styled summary rows,
- known report structure from the generator.
For each subtotal row, capture:
- section name or identifier,
- subtotal row number,
- subtotal formula text,
- the expected detail row span according to neighboring visible rows and section boundaries.
Do not assume the formula is correct just because a subtotal row exists.
4. Independently derive expected detail coverage
This is the key step.
For each section, determine which visible detail rows should contribute to the subtotal without using the subtotal formula itself as the source of truth.
Possible ways to derive the expected rows:
- rows between the section header and the subtotal row,
- rows until the next section header,
- rows matching a known indentation or outline level,
- rows with detail labels but excluding headers and subtotal labels,
- rows included by the source data mapping used to build the section.
The important rule:
The expected detail set must be computed independently from the formula being checked.
Otherwise, the audit only repeats the original mistake.
Include only visible detail rows when visibility matters
If the report hides rows, collapses groups, or applies filters, inspect whether the subtotal is supposed to summarize:
- all underlying rows, or
- only
FAQ
Is a file-exists check enough?
No, the guide says simple checks miss wrong formula ranges, so the totals must be verified.
What counts as a mismatch?
A subtotal formula that does not include all of the visible detail rows for its section.
Which rows are checked?
Every populated output row, including its formulas, along with any blank, hidden or filtered rows.
Details
Original description by the author
Audit generated Excel reports by enumerating populated output rows, exposing formulas, and checking that each subtotal range includes all visible detail rows.
repo: HKUDS/AgentPilot
Popularity
- GitHub stars
- 7.8k
- Ranking position
- #12876
- License
- MIT
- Updated
- 11/1/2026
Comments
- …
More skills from this repository
agentpilot
7.8kHelps your agent improve a project step by step by preparing a task and running the AgentPilot loop that proposes, tests and scores changes.
openspace
7.8kHelps your agent set up OpenSpace, a tool that stores and fetches agent skills, and connect it to your AI app through MCP.
rsi-arena
7.8kHelps your agent set up and run standard AI benchmark tests, such as AIME and Terminal-Bench, to compare different improvement methods.
experiment-guide
7.8kHelps your agent plan small experiments, read their results and record findings while it investigates how to improve a program.
Similar skills
feishu-doc
394kHelps your agent read, create, and edit Feishu cloud documents, including text, images, and tables, using the document tool.
feishu-drive
394kLets your agent browse, organize, and comment on files in a Feishu cloud folder that has been shared with the bot.
feishu-perm
394kHelps your agent check and change who can access a Feishu file, choosing the smallest permission that meets your request.