AN LLM AGENT BUILDS A FUNCTIONAL COST-EFFECTIVENESS MODEL IN EXCEL WITH LIVE FORMULAS AND VBA MACROS FROM A WRITTEN SPECIFICATION: A NOVEL ARCHITECTURAL APPROACH

Author(s)

Andre Verhoek, MSc1, Suzan Serip, MSc2, Yiduo Zhang, BA, MA, PhD2.
1HMS Lead, AstraZeneca, Barcelona, Spain, 2AstraZeneca, Barcelona, Spain.
OBJECTIVES: Health economic models for HTA submissions are predominantly Excel-based, yet published work on LLM-assisted model development has focused exclusively on R/Python. LLMs cannot directly manipulate binary Excel formats (.xlsm), creating a fundamental barrier to automated construction of submission-grade models. We developed a novel architectural approach enabling an LLM agent to build a complete Excel cost-effectiveness model, including VBA macros
METHODS: The architecture separates code generation from binary workbook assembly. An LLM agent (Claude, Anthropic) reads a specification document and emits two artefacts: (1) a Python build script using openpyxl that constructs each sheet with live Excel formulas (not hardcoded values), and (2) standalone VBA module files (.bas) containing macro code for deterministic sensitivity analysis (DSA) and scenario analyses. The .bas files are imported directly into the resulting .xlsm. We applied the approach to a 29-sheet Markov cost-effectiveness model in multiple sclerosis, generated from a 25-page specification across six phases covering input parameters, the Markov engine (relapsing and progressive sub-models), outcome calculations, treatment-waning scenarios, and DSA/scenario macros with automated tornado-chart generation.
RESULTS: The complete model was built in under 3 hours wall time at an estimated API cost of $25-$30, from specification to functional .xlsm with live formulas and importable VBA. Seven corrections were required across all six phases, every one identified on first human review. The generated VBA modules executed correctly in Excel, producing DSA tornado charts and 13 scenario analyses. No prior method has demonstrated LLM-generated VBA for health economic models; Reason et al. (2024) generated R code only, and Rawlinson et al. (2025) adapted parameters in pre-existing Excel models rather than building de novo.
CONCLUSIONS: Decoupling VBA generation (.bas text files) from binary workbook construction enables LLM agents to produce submission-ready Excel health economic models with functional macros, bridging LLM code-generation capability with the Excel-based workflows required by HTA agencies.

Conference/Value in Health Info

2026-11, ISPOR Europe 2026, Vienna, Austria

Value in Health, Volume 29, Issue 12S

Code

MSR158

Topic

Economic Evaluation, Health Technology Assessment, Methodological & Statistical Research

Topic Subcategory

Artificial Intelligence, Machine Learning, Predictive Analytics

Disease

No Additional Disease & Conditions/Specialized Treatment Areas

Your browser is out-of-date

ISPOR recommends that you update your browser for more security, speed and the best experience on ispor.org. Update my browser now

×