The Excel Formula Problem That Trips Up Language Models
Here's a simple request that ChatGPT, Claude or any other language model cannot carry out correctly on its own:
"Update the base price in my Excel model to $110"
Seems simple, right? Here is why a model that only sees what you paste into the chat cannot do it. All workbooks and numbers in this post are made-up examples.
The Hidden Complexity of "Simple" Spreadsheets
What You See
+---------------------------+
| Base Price: $100 |
| Your Price: $84.50 |
+---------------------------+What's Actually Happening
+------------------------------------------------+
| A1: Base Price = $100 |
| A2: Volume = [User Input] |
| A3: Customer ID = [User Input] |
| A4: Region = [User Input] |
| |
| B1: =IF(A2>100,5%,IF(A2>50,3%,0)) |
| B2: =VLOOKUP(A3,Sheet2!A:C,3,FALSE) |
| B3: =INDEX(RegionRates,MATCH(A4,Regions,0)) |
| B4: =A1*(1-B1)*B2*B3 |
| |
| Hidden Sheet2: |
| - 500 rows of customer tier data |
| - Complex pricing matrices |
| |
| Hidden Sheet3: |
| - Regional multipliers |
| - Tax calculations |
| - 47 dependent formulas |
+------------------------------------------------+When you change A1 from $100 to $110, Excel instantly updates all 47 dependent cells across 3 sheets. A model that was only shown the visible values has no idea these connections exist.
Four Reasons a Language Model Can't Do Excel on Its Own
1. AI Can't See Formula Dependencies
AI's View Excel's View
+------------------+ +------------------------+
| A1: 100 | | A1: Input Value |
| B1: 0.03 | | B1: =Formula→A2 |
| C1: 1.15 | | C1: =Formula→B1,A3 |
| D1: 84.50 | | D1: =Formula→A1,B1,C1 |
| | | +43 more dependencies |
+------------------+ +------------------------+
Sees numbers Knows relationshipsAI sees static values. Excel maintains a complete dependency graph of which cells affect which other cells.
2. AI Can't Follow Named Ranges and Tables
Your Excel Formula:
=SUMIF(SalesData, ">"&Threshold, CommissionRates)AI's Problem:
+-----------------------------------+
| AI's Confusion |
+-----------------------------------+
| SalesData = ??? |
| Threshold = ??? |
| CommissionRates = ??? |
| |
| *Attempts to guess* |
| "Maybe SalesData is column A?" |
| "Threshold might be 1000?" |
| |
| Result: Wrong calculation |
+-----------------------------------+Excel's Reality:
+-----------------------------------+
| Excel's Knowledge |
+-----------------------------------+
| SalesData = Sheet4!A2:A500 |
| Threshold = Config!B7 |
| CommissionRates = Sheet4!C2:C500 |
| |
| Resolves all references |
| Calculates precisely |
| |
| Result: Correct every time |
+-----------------------------------+3. AI Can't Handle Array Formulas and Spill Ranges
Modern Excel Dynamic Arrays:
=SORT(FILTER(Data, (Data[Status]="Active") * (Data[Revenue]>10000)), 3, -1)+------------------------------------------+
| What Happens |
+------------------------------------------+
| Excel: |
| 1. Filters active records |
| 2. Checks revenue > 10000 |
| 3. Sorts by column 3 descending |
| 4. Spills results automatically |
| 5. Updates when data changes |
| |
| AI: |
| 1. "I'll try to filter..." |
| 2. Can't access Data table |
| 3. Doesn't understand spill behavior |
| 4. Attempts to hardcode results |
| 5. Breaks when anything changes |
+------------------------------------------+4. AI Invents Functions That Don't Exist
Common AI Hallucinations:
=FINANCECALC(amount, rate, term)
=LOAN.PAYMENT(principal, interest, months)
=CALCULATETAX(income, deductions)
=PRICE.ADJUSTMENT(base, discount, tier)Actual Excel Functions:
=PMT(rate, nper, pv)
=IPMT(rate, per, nper, pv)
=VLOOKUP(lookup_value, table_array, col_index_num)
=INDEX(array, MATCH(lookup_value, lookup_array, 0))AI pattern-matches function names from training data, often creating plausible-sounding but non-existent functions.
Real-World Example: The "Simple" Loan Calculator
Let's walk through what happens when someone asks for loan calculations:
The Request
"Calculate monthly payment for a $500,000 loan"
What the User Sees
+----------------------------+
| Loan Amount: $500,000 |
| Monthly Payment: $3,218 |
+----------------------------+The Hidden Excel Reality
+---------------------------------------------------+
| The Calculation Web |
+---------------------------------------------------+
| |
| Input Cells: |
| A1: LoanAmount = 500000 |
| A2: CreditScore = [User Input] |
| A3: LoanType = [User Input] |
| |
| Lookup Tables (Hidden): |
| RateTiers: 20 rows x 5 columns |
| CreditMatrix: 8 x 10 grid |
| LoanTypeMultipliers: 15 categories |
| |
| Calculation Chain: |
| B1 → B2 → B3 → B4 → B5 → Result |
| ↓ ↓ ↓ ↓ ↓ |
| B6 → B7 → B8 → B9 → B10 |
| ↓ ↓ ↓ ↓ ↓ |
| C1 → C2 → C3 → C4 → C5 |
| |
| Final Output: |
| Payment + 360-row amortization schedule |
| + Tax implications + Insurance estimates |
+---------------------------------------------------+What AI Attempts:
# AI's approximation
def calculate_payment(loan_amount):
# AI guesses at interest rate
rate = 0.065 # Where did this come from?
months = 360 # Assumes 30 years
# The standard annuity formula
payment = loan_amount * (rate/12) / (1 - (1 + rate/12)**(-months))
return payment # The rate is a guess, and every other factor is missingWhat Excel Actually Does:
=PMT(
VLOOKUP(A1,RateTiers,2,TRUE) +
INDEX(CreditMatrix,MATCH(A2,CreditScores,1),MATCH(A1,LoanAmounts,1)) +
HLOOKUP(A3,LoanTypeMultipliers,2,FALSE) +
MarketAdjustment,
YearsInput*12,
-A1
)Plus 47 other cells that update based on this calculation.
The Accuracy Problem: Compound Errors
+-----------------------------------------------+
| Error Propagation |
+-----------------------------------------------+
| |
| Step 1: Base Calculation |
| AI: $1,000.00 × 1.1 = $1,100.00 correct |
| |
| Step 2: Apply Discount |
| AI: Forgets it's 3% not 30% |
| Result: $770 (should be $1,067) wrong |
| |
| Step 3: Add Tax |
| AI: Uses wrong tax rate |
| Result: $847 (should be $1,174) wrong |
| |
| Step 4: Calculate Commission |
| AI: Based on wrong previous amount |
| Result: Completely wrong |
| |
| Every later step inherits the error |
+-----------------------------------------------+The Solution: SpreadAPI
Instead of letting the AI recreate Excel logic, let it call the workbook:
How SpreadAPI Works
+------------------------------------------------+
| Your Excel + SpreadAPI |
+------------------------------------------------+
| |
| 1. Import your existing Excel workbook |
| → The formulas stay as they are |
| → Lookup tables and other sheets included |
| → VBA macros do not run |
| |
| 2. Choose input and output cells |
| → Inputs: A1, A2, A3 |
| → Outputs: D10, E15, F20 |
| |
| 3. Publish and call the API |
| → Send: {"inputs": {"loan": 500000}} |
| → Receive: outputs, e.g. payment 3218.47 |
| |
| 4. AI assistants connect over MCP |
| → The AI handles the conversation |
| → The workbook handles the calculation |
| → The user gets the calculated result |
+------------------------------------------------+Code Example
Without SpreadAPI (AI Alone):
// AI attempts to calculate
async function calculateWithAI(prompt) {
const response = await ai.complete({
prompt: `Calculate: ${prompt}`,
model: 'gpt-4'
});
// Returns something like:
// "The monthly payment would be approximately $3,200"
// An estimate, and you cannot tell how close it is
return response;
}With SpreadAPI:
// The workbook calculates
async function calculateWithExcel(inputs) {
const url =
'https://spreadapi.io/api/v1/services/{serviceId}/execute';
const response = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ inputs })
});
// The answer holds the outputs your formulas calculated:
// "outputs": [
// { "name": "monthlyPayment", "value": 3218.47 },
// { "name": "totalInterest", "value": 658649.2 }
// ]
return response.json();
}The Technical Truth
What AI Is
- A pattern recognition system
- Trained on text, not formulas
- Predicts likely responses
- On its own, no access to your workbook's calculation
What Excel Is
- A calculation engine
- Maintains complete dependency graphs
- Evaluates formulas in the correct order
What SpreadAPI Does
- Connects AI assistants and your workbook, over MCP or the REST API
- Calculates with your formulas on the server
- Gives callers inputs and outputs, not the workbook
- Returns the results the formulas calculated
Common Objections Answered
"But AI can do math!"
AI can do simple arithmetic. It cannot maintain calculation state, follow dependencies, or reliably reproduce Excel's hundreds of functions.
"Why not code the formulas?"
Your Excel has years of validated business logic. Recreating it in code introduces bugs, maintenance work and two versions that drift apart.
"Can't I just paste formulas to AI?"
AI won't have access to your lookup tables, named ranges, hidden sheets, or data validation rules. It sees formulas but not the data they reference.
The Bottom Line
AI excels at understanding what you want. Excel excels at calculating it correctly. SpreadAPI connects them.
Your Excel formulas represent years of refined business logic. They handle edge cases you've forgotten exist. They include regulatory requirements, special customer agreements, and complex conditional logic that would take months to recreate.
Don't let AI approximate your calculations. Use your actual Excel.
Next Steps
- Pick a critical calculation. Which Excel workbook drives decisions, and where would a wrong number hurt most?
- Test your current approach. Ask your AI assistant for a result of that model and compare it with Excel.
- Connect the workbook. Publish it as a service on SpreadAPI and connect your assistant, so the AI handles the question and the workbook the calculation.
Turn an Excel workbook into an API
Further Reading
- Excel MCP server: a developer's guide
- Claude Desktop + Excel: the complete guide
- Why answers are calculated
- Supported Excel features
Questions? Contact support@airrange.io