AI in the office
Use Ollama with Excel Locally: Free Offline AI for Formulas
In this article
To use Ollama with Excel, you need a spreadsheet app whose AI assistant accepts a custom OpenAI-compatible server. Install Ollama, download a model with ollama pull, then point the app's AI pane at http://localhost:11434/v1. Microsoft Copilot can't be redirected to a local model. Microads Office Excel can: its AI assistant connects to an OpenAI-compatible server such as Ollama running on your own PC, with no AI subscription.
This guide covers the setup and three test tasks: writing a formula, explaining a nested formula and building a chart. Each task has a known correct answer, so you can grade whichever model you install and catch the mistakes small local models tend to make.
What you need before you start
- A Windows 10 or 11 PC, 64-bit. Microads Office runs only on 64-bit Windows. Ollama also runs on macOS and Linux, but the spreadsheet side of this guide is Windows-only.
- Enough memory for a model. As a rough rule, small 3B models run on 8 GB of RAM. 7B–8B models are more comfortable with 16 GB. A GPU speeds things up but isn't required. Treat these numbers as a starting point, not a guarantee.
- A few GB of free disk space for the model files.
- Internet once, to download Ollama and the model. After that, everything works offline.
Step-by-step setup
- Install Ollama. Download the Windows installer from ollama.com and run it. Ollama starts a background server automatically.
- Download a model. Open Command Prompt or PowerShell and run:
If you have 8 GB of RAM or less, try a smaller one:ollama pull qwen2.5:7b
Coder-tuned models such asollama pull llama3.2:3bqwen2.5-coder:7bare also worth testing for formulas. - Check the exact model name. Run
ollama list. Copy the name exactly as shown, for exampleqwen2.5:7b. A missing tag or a typo is the most common reason the connection fails later. - Confirm the server is running. Open
http://localhost:11434in a browser. You should see the text Ollama is running. You can also chat in the terminal withollama run qwen2.5:7bto see how fast the model answers on your hardware. - Open the AI pane in your spreadsheet. In Microads Office Excel, click the purple sparkle button on the Home tab. A side pane opens.
- Choose the OpenAI-compatible server option and enter:
Setting Value Base URL http://localhost:11434/v1Model The exact name from ollama list, e.g.qwen2.5:7bAPI key (if a field requires one) Any placeholder, e.g. ollama. Ollama ignores it. - Send a short test message, such as "Reply with OK." If you get an answer, the connection works.
The assistant only connects when you click Send, and it goes directly to the service you chose, never through Microads servers. With Ollama on localhost, the request never leaves your computer. The app's only other automatic connection is the update check, and you can switch it off.
Test it on real spreadsheet tasks
Use a small sample where you already know the answers. That way you can judge the model before trusting it with real work. Enter this in A1:D9:
| A: Order | B: Region | C: Rep | D: Amount |
|---|---|---|---|
| 1001 | North | Lan | 1200 |
| 1002 | South | Minh | 450 |
| 1003 | North | Hoa | 380 |
| 1004 | East | Lan | 950 |
| 1005 | South | Minh | 1500 |
| 1006 | North | Hoa | 640 |
| 1007 | East | Tuan | 220 |
| 1008 | North | Lan | 510 |
A note on results: output from local models changes with the model version, quantization and even the wording of your prompt, so we don't publish a pass/fail score per model here. The mistakes listed below are the kinds of errors to look for, not guaranteed outcomes. Run the same three prompts on each model you install and record which ones hit the known answers.
Task 1: Write a formula into the sheet
Prompt: "Data is in A1:D9 with headers in row 1. Column B is Region, column D is Amount. Write a formula for the total Amount for North where Amount is over 500."
The correct answer is:
=SUMIFS(D2:D9,B2:B9,"North",D2:D9,">500")The result should be 2350 (1200 + 640 + 510). Order 1003 is excluded because 380 is not over 500. If the assistant writes the formula into the sheet and you don't like it, one Ctrl+Z undoes it.
What to watch for: a model may mix up SUMIF and SUMIFS and produce something like this:
=SUMIF(B2:B9,"North",D2:D9,">500")SUMIF takes only three arguments, so Excel rejects this with "You've entered too many arguments for this function." Another possible slip is putting the sum range last in SUMIFS. That's the SUMIF order; in SUMIFS the sum range comes first. Smaller 3B models are generally more likely to make this kind of error than 7B models, so if one fails, try the larger model before giving up.
Task 2: Explain a nested formula
Put an order number in G2 and this formula in H2, then ask the assistant to explain it:
=IFERROR(INDEX($D$2:$D$9,MATCH(G2,$A$2:$A$9,0)),"Not found")A good explanation should say:
- MATCH looks for the order number in A2:A9.
- The 0 means exact match.
- INDEX returns the amount in the same row of D2:D9.
- IFERROR replaces the #N/A error with "Not found".
Check it yourself: G2 = 1005 returns 1500, and G2 = 1010 returns Not found.
Watch for confident errors. A model might claim the 0 means "approximate match", or say the dollar signs make the formula "faster", when they actually lock the ranges so the formula can be copied down. A second good test is a tier formula: =IF(D2>=1000,"Gold",IF(D2>=500,"Silver","Standard")) returns Gold for 1200, Silver for 510 and Standard for 450. Ask the model what happens at exactly 500. The right answer is Silver, because the test is >=.
Task 3: Build a chart
Ask for totals by region and a column chart. A clean approach uses headers plus two dynamic-array formulas:
J1: Region
K1: Total
J2: =UNIQUE(B2:B9)
K2: =SUMIFS($D$2:$D$9,$B$2:$B$9,J2#)This spills North 2730, South 1950 and East 1170. These add up to 5850, the same as =SUM(D2:D9), which is a quick sanity check. The Microads Office assistant can write formulas, tables and charts into the sheet. If your model returns only text instructions instead, select J1:K4 (including the headers, so the chart gets proper labels) and insert a column chart yourself.
How to check what the model gives you
- Test on known data first. Use a sample like the one above before pointing the formula at thousands of rows.
- Reconcile totals. Grouped sums should add up to the grand total, and counts should match
=COUNTA()of the column. - Try edge cases. Check blanks, numbers stored as text and a lookup value that doesn't exist.
- Split nested formulas into helper cells. Put the MATCH part in its own cell and check it before trusting the full INDEX/MATCH. Microsoft Excel has Evaluate Formula for this. Microads Office Excel doesn't, so use helper cells and Show Formulas there.
- Check every function name. If a name doesn't appear in the function suggestions as you type, the model may have invented it.
Common mistakes and fixes
| Symptom | Cause | Fix |
|---|---|---|
connection refused on port 11434 | The Ollama server isn't running | Start the Ollama app, or run ollama serve |
model "x" not found, try pulling it first | Wrong model name, or the model isn't downloaded | Run ollama list and copy the name exactly, including the tag |
A port-in-use error when you run ollama serve | Ollama is already running in the background and holding port 11434 | Nothing to fix; just connect to the running server |
| Formula shows an error after pasting | Comma vs semicolon argument separator. In Microsoft Excel this follows the List separator in your Windows regional settings, and regions such as Vietnam and much of Europe often use ; | Check which separator your own formulas use; if it's ;, add "use semicolons as separators" to your prompt |
| Results shift when the formula is copied down | Missing $ on ranges, or an off-by-one range such as D2:D8 | Ask the model to use absolute ranges, then check that the range ends on your last data row |
| Answers ignore part of your data | The model's context window is too small | Describe the columns instead of pasting the whole sheet, or raise OLLAMA_CONTEXT_LENGTH |
| Very slow replies | The model is too large for your RAM or GPU | Switch to a 3B model, or close other heavy apps |
Variations
- Microsoft Excel users. Copilot can't use a local model. You can still run
ollama run qwen2.5:7bin a terminal and paste the formulas into Excel. The SUMIFS, INDEX/MATCH and UNIQUE formulas above work the same way in Excel 365. Files saved with the new functions in Microads Office open correctly in Excel 365. - No local hardware to spare. The same AI pane can also use your own ChatGPT Plus/Pro plan, a Claude or OpenAI API key, or a Claude Pro/Max plan through Claude Desktop. These are cloud services, so your prompts do leave the PC.
- Just need one formula quickly. The AI Excel formula generator is an online tool, so whatever you type is sent over the Internet, unlike the Ollama setup. Use it for generic questions, not for confidential data.
- Reusable logic. Once the model gives you a working formula, wrap it in LAMBDA so you don't have to ask again. The numbers-to-words LAMBDA guide shows the pattern.
If you're setting up a whole offline, account-free workstation, the free Word and Excel for Windows 11 checklist covers the rest. You can get Microads Office free, with no account or sign-up.

Frequently asked questions
Which Ollama model is best for Excel formulas?
Start with a 7B model such as qwen2.5:7b or qwen2.5-coder:7b if you have 16 GB of RAM, and llama3.2:3b on smaller machines. Run the same sample prompts on each and keep the one that gets the known answers right most often.
Is this setup really free and private?
Yes. Ollama and Microads Office are both free, and with the base URL set to localhost the AI requests stay on your computer. Microads does not sell AI credits, and the app's only automatic connection is an update check you can turn off.
Does this work on a Mac?
Ollama runs on macOS, but Microads Office is Windows 10/11 64-bit only. On a Mac you would need another spreadsheet app or add-in that accepts a custom OpenAI-compatible URL.
Can the local model read my whole spreadsheet?
Small local models have limited context windows, so large ranges may be cut off without warning. Describe your column layout and a few sample rows in the prompt instead of pasting thousands of cells.
Can I use Ollama with Excel's Copilot?
No. Copilot uses Microsoft's own cloud models and can't be pointed at a local server. To use a local model with Microsoft Excel, you need a third-party add-in with a configurable endpoint, or you can copy formulas from Ollama's terminal.
Microads Office is a free Word, Excel and PDF suite for Windows built by Microads Technology Co., Ltd. (Ho Chi Minh City, Vietnam) and open source under GPL-3.0. Articles are written by the Microads Office team with AI assistance and checked against the software’s real features. Source code · Download
NETWORKDAYS.INTL Friday–Saturday Weekend: Payroll Worked Example
Word Table of Contents Not Updating Headings? 6 Fixes
Sign a PDF with a .pfx File for Free (and Keep It Safe)