Microsoft · KDD 2025 workshop
Fixing Excel formulas
At Microsoft, my co-authors and I tested whether a language model could fix a broken spreadsheet formula. We ran each repair in the sheet to see if it gave the right answer.
Try a price lookup
This example from our paper looks up the price of a fruit. Mango is missing from the list.
Item to find Mango
- Original formula
- #N/A
- Repaired formula
- Not found
See the two formulas
The original formula asks for the price in column B. The repair first checks whether the fruit appears in column A.
Original=VLOOKUP(A10,A2:B7,2,FALSE)
Repaired=IF(COUNTIF(A2:A7,A10)>0,VLOOKUP(A10,A2:B7,2,FALSE),"Not found")
How often did the repair work?
GPT-4.1 returned the expected result on 80% of our generated cases and 41% of the original forum examples. The other three models also did worse on the forum cases.
See all scores for the four models
We checked three things. Was the formula valid? Did it run? Did the result match the expected value?
| Model | Dataset | Syntax | Runs | Exact match |
|---|---|---|---|---|
| GPT-4.1 | Generated | 100% | 96% | 80% |
| GPT-4.1 | Forum seed | 98% | 65% | 41% |
| GPT-4o | Generated | 100% | 93% | 73% |
| GPT-4o | Forum seed | 96% | 63% | 35% |
| Phi-3 | Generated | 81% | 77% | 58% |
| Phi-3 | Forum seed | 73% | 41% | 24% |
| Mistral | Generated | 78% | 76% | 51% |
| Mistral | Forum seed | 67% | 37% | 19% |
Where the cases came from
We started with 59 real examples from Excel forums. Each needed the person’s question, the sheet and a repair we could run. We generated variations and kept 618 that passed our checks.
Worksheet images adapted from Figures 1 and 4 of Benchmark Dataset Generation and Evaluation for Excel Formula Repair with LLMs, Singha et al. CC BY 4.0.
Read the paper on arXiv