# Can You Keep Excel Formulas and VBA Macros in a Web App?

> Formulas survive as database rules with one answer for everyone. VBA does not run in a browser, so macros become app actions and jobs. A formula-by-formula map.

Source: https://llamapress.ai/can-you-keep-your-excel-formulas-and-vba-macros-when-you-convert-to-a-web-app | Updated: 2026-09-02

---

[LlamaPress Blog](https://llamapress.ai/blog)

Formulas survive as database rules with one answer for everyone. VBA does not run in a browser, so macros become app actions and jobs. A formula-by-formula map.

 [Back to all articles](https://llamapress.ai/blog)

![Kody Kendall](https://llamapress-ai-image-uploads.s3.us-west-2.amazonaws.com/jujc1ep8nuqrdiftdfer1ngp833u)

Written by

### Kody Kendall

AI & Software Engineer | Creator of the Leonardo Coding Agent

Updated September 2026

Your Excel formulas survive the move to a web app. What your VBA macros do survives too, though the VBA code itself does not. A web app rewrites each formula as a database rule or a calculation in code, so the result is the same for every user. VBA does not run in a web app, and Microsoft's own Excel for the web does not run VBA either. So each macro is rebuilt as an app action, a form screen, or a background job that does the same work. You keep the behavior and drop the fragile code.

In short

- Every common Excel formula has a web app equivalent: a VLOOKUP becomes a link between two tables, and a SUMIFS becomes a report.
- VBA never runs in a browser. Microsoft's Excel for the web opens .xlsm files but does not run the macros inside them.
- Each macro is rebuilt as a button, a form, a scheduled job, or a notification that does the same work in tested code.
- Circular references, Goal Seek, and formulas that point at other open workbooks do not translate and need a redesign.
- The rebuilt logic runs on the server, so nobody can overwrite a formula by accident, and every rule has a test.

I build the software behind LlamaPress, and I created Leonardo, the coding agent that reads the workbooks people upload. A large part of my week is spent reading formulas and macro modules that someone else wrote years ago. The same twenty or so patterns show up in almost every file. This page lists those patterns and says what each one becomes. The older argument for why teams leave VBA at all lives on our page about [converting Excel VBA to web applications](https://llamapress.ai/beyond-the-spreadsheet-converting-excel-vba-to-web-applications). This page is the map.

![Laptop screen showing a spreadsheet with formulas and charts, the kind of workbook a web app rebuilds as database rules](https://images.unsplash.com/photo-1504868584819-f8e8b4b6d7e3?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3w4NTU2MDF8MHwxfHNlYXJjaHwxfHxzcHJlYWRzaGVldCUyMGZvcm11bGFzJTIwbGFwdG9wfGVufDB8fHx8MTc4ODM2MTg5OHww&ixlib=rb-4.1.0&q=80&w=1080)

Photo by [Lukas Blazek](https://unsplash.com/@goumbik?utm_source=leonardo_rails_app&utm_medium=referral) on [Unsplash](https://unsplash.com/photos/turned-on-black-and-grey-laptop-computer-mcSDtbWXUZU?utm_source=leonardo_rails_app&utm_medium=referral)

## Do Excel formulas work in a web app?

No formula runs as a formula inside a web app. Every formula becomes code or a database rule that produces the same answer. The move is a translation, and most of the translations are routine. A VLOOKUP asks a question: which row in another table matches this key? A database answers that question with a relationship between two tables. A SUMIFS asks a different question: what is the total of the rows that match these conditions? A database answers with an aggregate query and shows the total on a report. The table below maps the formulas I see most often to what they become.

| Excel formula | What it becomes in a web app | What changes for your team |
| --- | --- | --- |
| VLOOKUP, XLOOKUP, INDEX/MATCH | A relationship between two tables (a job belongs to a customer) | The lookup cannot return #N/A. The app stores the link and blocks deleting a customer that still has jobs. |
| SUMIFS, COUNTIFS, AVERAGEIFS | An aggregate query shown on a report or dashboard screen | Totals update the moment a row changes and can be filtered by any field. No helper columns. |
| IF, IFS, nested IF | A validation rule or a status rule on the record | IF(margin<0.15,"Review","OK") becomes a status the app sets and a rule that blocks saving below the floor. |
| EDATE, NETWORKDAYS, DATEDIF, TODAY | Date functions in code, plus a holiday table you can edit | Weekend and holiday rules live in one place instead of in every cell that needs a due date. |
| Named ranges and rate tables | A settings or rates table with its own admin screen | An admin edits a rate on a screen. The change applies everywhere and is logged with a name and a time. |
| Data validation dropdown lists | Dropdowns backed by a table | Adding an option is a new row. Old records keep the option they were saved with. |
| Conditional formatting | Status badges and row colors set by a rule | Red rows for overdue items look the same on a phone as on a desktop. |
| Pivot tables | Saved reports with filters and grouping | The report runs on live data every time. Nobody has to press Refresh. |
| Dynamic arrays, LET, LAMBDA | Functions in code with automated tests | A test proves the function returns the right answer for known inputs before anyone uses it. |
| INDIRECT, OFFSET, volatile tricks | A redesign | These usually exist to fake a database feature. The app has the real feature, so the trick goes away. |

Formula errors are the quiet reason this translation is worth doing. Ray Panko's research at the University of Hawaii is summarized in his 2008 paper [Spreadsheet Errors: What We Know](https://arxiv.org/abs/0802.3457). Field audits since 1997 found errors in 91% of the operational spreadsheets they checked. Panko also reports cell error rates of 1% to 2% in whole spreadsheets. A rule in code runs once, in one place, with a test. A formula runs in every cell someone copied it into, and one of those copies is usually wrong.

## How to convert Excel VBA to a web application

You do not port the VBA. You list what each macro does, then rebuild each one as an app feature that does the same work. Microsoft's documentation on [using a workbook in the browser](https://support.microsoft.com/en-us/office/differences-between-using-a-workbook-in-the-browser-and-in-excel-f0dc28ed-b85d-4e1d-be6d-5878005db3b6) says a macro-enabled workbook "can be opened but macros do not run in a browser window." A web app is a browser program, so the same rule applies to any app you build.

Microsoft's own answer for browser automation is [Office Scripts](https://learn.microsoft.com/en-us/office/dev/scripts/overview/excel), written in TypeScript. The documentation describes a recorder that turns "manual steps into reusable scripts." You run a script "with a button in Excel or combine it with Power Automate." As of this writing, the same page says script scheduling is temporarily disabled inside Office Scripts, and it points you to Power Automate for schedules. Office Scripts is a fair choice if the goal is one button inside one shared workbook. A script still lives inside a file that many people open, so the overwrite and sharing problems stay. The table below maps the macro patterns I see most often to the app features that replace them.

| VBA macro pattern | What it becomes in a web app | What changes for your team |
| --- | --- | --- |
| Button macro (a Sub tied to a form control) | An action button on the record screen | "Generate Quote" runs on the server and logs who pressed it and when. |
| Loop over rows (For Each cell In range) | A background job | A 10,000-row loop finishes on the server in seconds. Nobody watches an hourglass or loses a frozen Excel window. |
| Workbook\_Open, Auto\_Open | A scheduled job | The job runs at 6:00 am whether or not anyone opens a file that day. |
| UserForm | A form screen with validation | Required fields, dropdowns, and error messages are built in. The form works on a phone. |
| Outlook automation (CreateObject Outlook.Application) | Email and SMS notifications sent by the app | Messages send from the server. Nothing depends on one person's Outlook being open. |
| Export to PDF or CSV | An export feature | One click, one template, and the file is stored with the record it came from. |
| Copy between workbooks | An import screen or an integration | The app imports the supplier file or calls the other system directly. No paste step. |

Two things change when a macro becomes an app feature. First, the logic runs on the server, so a user cannot break the feature by deleting a column or renaming a tab. Second, the feature has a test. When we rebuild a "Generate Quote" button, we write a test that feeds in a known job and checks the quote total. That test runs every time the code changes. A macro has no equivalent. Our page on [the hidden cost of Excel macros](https://llamapress.ai/the-hidden-cost-of-excel-macros-why-automation-is-stalling-your-growth) covers the business case for removing them in the first place.

## What does not translate, and what to do instead

Five patterns need a redesign rather than a translation. Plan for them before the build starts.

**Circular references with iterative calculation.** An app computes values in a defined order. A circular formula has no order. The fix is to make the loop explicit in code: repeat the calculation until the change is below a tolerance, then stop. In most workbooks I read, the circle was an accident, and the math can be restructured to remove it.

**Goal Seek and Solver.** These are interactive tools a person drives by hand. The app rebuilds the one or two inputs people vary as a "what if" screen with sliders or fields. A true optimization model with dozens of constraints should stay in Excel, at least for the first version.

**Hidden helper columns.** A hidden column is logic nobody wrote down. Unhide every column before you inventory the workbook. Most helper columns become a named calculation in code. Many disappear because the database can filter and join without them.

**Formulas that reference other open workbooks.** A reference like [Rates2024.xlsx]Sheet1!B7 breaks the day someone moves the file. In an app, that link becomes a rates table or a scheduled import from the other file.

**Macros in PERSONAL.XLSB.** These live on one PC and run only for one person. Nobody else can see them. Copy them out of that machine before the conversion starts, or the logic is lost when the PC is replaced.

![Computer screen showing lines of program code, where rebuilt spreadsheet formulas and macros end up running](https://images.unsplash.com/photo-1515879218367-8466d910aaa4?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3w4NTU2MDF8MHwxfHNlYXJjaHwxfHxwcm9ncmFtbWVyJTIwY29kZSUyMHNjcmVlbnxlbnwwfHx8fDE3ODgzNjE5MDF8MA&ixlib=rb-4.1.0&q=80&w=1080)

Photo by [Chris Ried](https://unsplash.com/@cdr6934?utm_source=leonardo_rails_app&utm_medium=referral) on [Unsplash](https://unsplash.com/photos/a-computer-screen-with-a-bunch-of-code-on-it-ieic5Tq8YMk?utm_source=leonardo_rails_app&utm_medium=referral)

## How do I inventory my formulas and macros before I convert?

Spend one afternoon and produce two lists: every rule the workbook enforces and every macro it runs. The inventory takes four steps, and none of them need a developer.

First, press Ctrl+\` on each tab to show formulas instead of values. Screenshot or print each tab in that view. Second, open the Name Manager with Ctrl+F3 and copy every named range and what it points to. Named ranges are where rate tables hide. Third, press Alt+F11 to open the VBA editor and expand each module in the Project pane. Write one line per module that says what the module does and what starts it. A line like "Module2: builds the quote PDF, runs from the Print button on Quote tab" is enough. Fourth, use File, Info, Inspect Workbook to find hidden sheets and hidden names, then Data, Edit Links to find every external workbook.

That inventory is the first thing to hand over in a conversion. Our page on [how to turn an Excel spreadsheet into a web app step by step](https://llamapress.ai/how-to-convert-your-excel-spreadsheet-to-a-web-application-without-rebuilding-from-scratch) shows where the inventory fits in the full process. Our page on [what the AI reads and what it asks](https://llamapress.ai/can-ai-build-a-web-app-from-your-excel-workbook-what-it-reads-and-what-it-asks) says which parts of that inventory an AI can find on its own.

## Can I keep the model in Excel and move only the process?

Yes, and for some teams that is the right call. A pricing model that one expert owns, reviews, and changes every quarter can stay in Excel. The app then imports the model's outputs, a rates table or a price list, and runs the daily process around them. Quotes, approvals, job tracking, and reports live in the app. The expert keeps a tool they trust. Nobody else touches the model.

Panko's 91% figure is an argument for moving the calculations that many people touch every day. The figure is a weaker argument for moving a model one careful person owns. Leave the model in Excel when the math changes often and one expert is the only user. A model whose outputs are a short list of numbers can stay there as well. Move the logic into the app when several people run the same calculation many times a day, or when a wrong answer costs real money. Our page on [whether to rebuild your workbook as software or keep using Excel](https://llamapress.ai/should-you-rebuild-your-excel-workbook-as-software-or-keep-using-excel) walks through that decision in full.

## How does Leonardo handle formulas and macros?

Leonardo, our AI coding agent, reads the formulas as the spec. When you [upload a workbook](https://llamapress.ai/excel-to-app), Leonardo reads every tab, every formula, every named range, and every data validation list. A VLOOKUP into a Customers tab becomes a customers table and a link from each job. A SUMIFS on a Jobs tab becomes a report. An IF chain on a margin cell becomes a validation rule with a test. VBA modules are read the same way. Leonardo writes down what each macro does. Then Leonardo rebuilds each one as a button, a form, a job, or a notification. The code is Ruby on Rails on a PostgreSQL database, and the code lands in your own GitHub repository.

A human engineer reviews every build and checks the rules with you before anyone relies on the app. We then run the app and the workbook side by side for a period you choose. You enter the same job in both and compare the totals. Any gap gets fixed before the workbook is retired. We have converted more than 400 spreadsheets this way. For a steel contractor's estimating workbook, that process took six weeks from kickoff to deployment. The team's estimates came out 62% faster at a 40% lower cost per estimate. The formulas in that workbook were the hard part, and every one of them survived. [Upload your workbook](https://llamapress.ai/excel-to-app) and Leonardo will show you the first tables and rules within minutes, free, with no card required.

From Spreadsheet to Software

### Keep the logic. Lose the fragile file.

Upload the workbook with the formulas and macros you rely on. Leonardo rebuilds the rules as tested code in an app you own outright.

[Convert My Workbook](https://llamapress.ai/excel-to-app) [Ask About My Macros](https://llamapress.ai/contact)

Prefer to talk first? [Contact us](https://llamapress.ai/contact) and we will look at your workbook with you.

## Frequently Asked Questions

### Can I keep my Excel formulas and VBA macros if I convert to a web app?

You keep the logic behind both. Excel formulas are rewritten as database rules and calculations in code that give every user the same answer. VBA macros do not run in a web app. Each macro is rebuilt as an app action, a form screen, or a background job that does the same work. The behavior survives and the fragile code is retired.

### Do Excel formulas work in a web app?

Excel formulas do not run as formulas in a web app. Each formula becomes an equivalent in code or in the database. A VLOOKUP becomes a relationship between two tables, a SUMIFS becomes a report, and an IF chain becomes a validation rule. The results match the workbook, and the rule runs in one place instead of in every copied cell.

### Can VBA run in a web browser?

VBA cannot run in a web browser. Microsoft's own documentation states that a macro-enabled workbook can be opened in the browser but the macros do not run. Microsoft's browser automation is Office Scripts, written in TypeScript, which runs from a button in Excel or through Power Automate. A web app rebuilds each macro as a feature in server-side code.

### How do you convert Excel VBA to a web application?

You inventory every macro first, with one line per module that says what the module does and what starts it. Then each macro pattern is rebuilt as an app feature. A button macro becomes an action button and a row loop becomes a background job. A UserForm becomes a form screen, and Outlook automation becomes an email or SMS notification. Each feature gets a test that proves the output matches the workbook.

### Will the numbers match my spreadsheet after conversion?

The numbers should match to the cent, and the parallel run proves it. The app and the workbook run side by side for a period you choose. Your team enters the same job in both and compares the totals. Any gap is a bug that gets fixed before the workbook is retired, and a test is added so the gap cannot come back.

### What happens to my pivot tables?

Pivot tables become saved reports in the app. Each report groups and filters live data the same way the pivot did, and the report is current every time someone opens it. Nobody needs to press Refresh or rebuild the pivot after adding rows. Reports can also be limited to the users who should see them.
