Enterprise ROI Calculator Rescue
BuildA VP of Sales hands you a broken Excel ROI calculator — 22 tabs, 9,414 formulas, half of them dead. Nobody can maintain it. Reps need it next quarter. You reverse-engineer the business logic, rebuild it in Google Sheets with Apps Script automation, add a guided wizard, validate every calculation, and ship full documentation.
The Slack Message
Our ROI calculator is broken. It's an Excel file with thousands of formulas and nobody can maintain it. Half the numbers are wrong. The reps are asking for it in every deal and we need it working by next quarter. Can you fix this?
The Prompt
The file landed in your inbox. Here is the plan you write after opening it.
VP Sales: "Our ROI calculator is broken. It's an Excel file with thousands of formulas.
Nobody can maintain it. Half the numbers are wrong. We need reps using it next quarter."
The file is a 22-tab Excel workbook with 9,414 formulas — most of them broken.
The business logic is buried inside wrapper functions that stopped working when
the file was converted from .xlsm to .xlsx.
Goal: reverse-engineer the business logic, rebuild it in Google Sheets with
Apps Script, add a guided wizard for reps, validate every calculation, and
ship full documentation — sales guide, admin guide, and quick reference.
Phase 1 — Audit
- Scan the workbook for every broken formula
- Extract the inner logic from 1,620 dummy function wrappers
- Catalog the 189 ISBETWEEN patterns and 262 ampersand artifacts
- Preserve everything in CSV for audit trail
Phase 2 — Extract core business logic
- Identify that the 9,414-formula model reduces to one equation:
Savings = Volume × Rate × AHT × (Agent $/min − Platform $/min) − Fee
- Map the 6 value drivers, 3 scenarios, and pricing tiers
- Document the architectural decisions
Phase 3 — Rebuild in Google Sheets
- Build 10 clean tabs with ~200 formulas (vs 9,414 broken ones)
- Write Apps Script: main engine, wizard backend, wizard UI
- Add 4 presets, 3 commercial paths, product selector
Phase 4 — QA and documentation
- Run 8 validation suites, fix the sheet-name reference bug
- Generate sales guide, admin guide, quick reference, and technical docs
- Ship to repsThe insight that changed the project
9,414 formulas sounds unsalvageable. But systematic audit revealed the core business logic was one equation: Savings = Volume × Rate × AHT × (Agent $/min − Platform $/min) − Fee The thousands of formulas were over-engineered 36-month projections with broken wrappers. Extracting the real logic and rebuilding with ~200 clean formulas plus Apps Script was faster and more maintainable than trying to patch the original.
How This Was Built
Audit the wreckage
Scan all 22 tabs. Find 9,414 broken formulas. Extract 1,620 dummy function wrappers into CSV with full cell references.
Catalog the damage
Identify 189 ISBETWEEN patterns and 262 ampersand artifacts. Build a transformation ruleset for each class of breakage.
Extract core business logic
Discover that 9,414 formulas reduce to one core equation plus 6 value drivers, 3 scenarios, and a tiered pricing engine.
Architect the rebuild
10 tabs instead of 22. Apps Script instead of nested formulas. Wizard sidebar instead of manual entry. Separate CI and CA modules with shared inputs.
Build the Apps Script engine
Write the main calculator engine, wizard backend, and wizard HTML frontend. Implement presets, scenario modeling, and pricing tiers.
Push and integrate
Deploy to Google Sheets via Gremlin. Wire up the menu system, product selector, tab visibility, and named ranges.
Validate everything
Run 8 QA suites: formula validation, architecture, product selection logic, pricing, ramp calculations, named ranges, formula count, ROI clarity.
Ship documentation
Generate sales user guide, admin guide, quick reference card, and full technical documentation. Publish to knowledge base.
"Opening the Excel workbook. 22 tabs. Let me scan for broken formulas first — anything with __xludf.DUMMYFUNCTION is a dead formula."
"The formulas are not random garbage — they are valid logic wrapped in a broken container. The DUMMYFUNCTION wrapper was added when .xlsm was saved as .xlsx and the UDFs stopped resolving. I need to strip the wrapper, fix the ampersand artifacts, and convert ISBETWEEN to AND()."
Building transformation rules for each class of breakage
"Looking at the converted formulas... the 3-year projection tab has 900 formulas that model 36 months of driver roadmaps with ISBETWEEN-gated tier transitions. This is massively over-engineered. The actual business logic is simple."
"The entire CA model reduces to: Savings = Volume × Resolution Rate × AHT × (Agent $/min − Platform $/min) − Platform Fee Three scenarios just vary the resolution rate (40% / 50% / 60%). The CI model has 6 value drivers but each one is a straightforward calculation. I don't need 9,414 formulas. I need ~200."
Designing the rebuild architecture: 10 tabs, Apps Script engine, wizard sidebar
Writing the Apps Script engine — main calculator, wizard, and UI
Generating documentation suite
Done. 9,414 broken formulas → 200 clean formulas. 22 messy tabs → 10 organized tabs. Zero documentation → 4 complete guides. Wizard, presets, scenarios, and pricing engine all operational.
Output Artifacts
Google Sheet: ROI Calculator
- Quick Calculator — 8 core inputs with instant results
- Wizard sidebar — 5-step guided flow with 4 presets
- Scenario Comparison — Bear / Base / Bull side-by-side
- Executive Summary — PDF-ready one-page output
- Customer Snapshot — Copy/paste block for emails
- Product selector — CI Only / CA Only / Both
Audit Trail and Documentation
- Formula audit CSVs — Every broken formula cataloged with cell references
- Transformation log — Before/after for all 1,620 converted formulas
- QA report — 8 validation suites, all passed
- Sales user guide — 2-minute quick start + wizard walkthrough
- Admin guide — Maintenance and configuration reference
- Technical docs — 660-line complete system reference
Requirements
The broken Excel workbook
The source file with the formulas that need reverse-engineering.
Python for audit scripts
Used for formula extraction, pattern cataloging, and transformation.
Google Sheets access
Target environment for the rebuild with Apps Script support.
Gremlin CLI
Deploys Apps Script, lints formulas, fixes references, snapshots.
Claude Code or Codex
Architects the rebuild, writes Apps Script, generates documentation.
Domain knowledge from stakeholders
Value driver definitions, pricing tiers, and scenario assumptions.
Results
From 9,414 formulas to ~200
97.9% reduction in formula complexity. The remaining formulas are clean, documented, and maintainable.
Reps get ROI in 2 minutes
Open wizard, pick a preset, adjust numbers, view results. No formula knowledge needed. Executive Summary is PDF-ready.
Based on a real enterprise ROI calculator rescue. Client details redacted; architecture, methodology, and metrics are the reusable pattern.
Related
Claude Code for RevOps
How AI coding agents work in RevOps: planner plus governed executor.
Read guideSpreadsheet Rescue
The general pattern for diagnosing, repairing, and documenting broken sheets.
See use caseBroken Sheet Playbook
The lighter version: inherit a sheet with #REF! errors and no docs.
See playbookB2B ROI Calculator Guide
The architecture guide for rebuilding ROI tools with explicit drivers, Apps Script, scenarios, and QA.
Read guideGot a broken calculator that reps are waiting on?
The pattern is audit, extract, rebuild, validate, document. Gremlin and Claude Code handle the heavy lifting.