A formula-generation prompt needs a target cell, column meanings, expected data types, intended fill range, calculation rule, and edge cases. Ask for the formula plus a small table of hand-checked inputs and outputs. Relative cell references move when copied; absolute references stay fixed; mixed references lock one axis. This is part of the contract, not a formatting preference. A model can propose a plausible expression, but the spreadsheet engine must parse it in the target product and locale, and a reviewer must confirm that it still points to the intended columns after filling. Keep text-valued SKUs out of arithmetic and reject numbers stored as text until they are normalized under an explicit rule.
Formula prompts: test references, types, and fill behavior
Operational case
In Stock, F2 should compute available units as B2+C2-D2 and fill through F48. A proposed formula for F2 uses E2 instead of D2 because E is labeled 'minimum'; it parses, yet it produces the wrong inventory balance. Another answer inserts a fixed $B$2 reference, so every row reuses the first SKU's on-hand value. The editor checks F2 and F3 with different input values before filling, then asks the workbook engine to calculate the full range. For SKU RM-47, B2=18, C2=7, D2=9 and E2=20, so F2 must be 16 and the reorder flag is true because 16 is below 20.
Target F2; fill F2:F48; formula =B2+C2-D2.
RM-47 row 2: 18 + 7 - 9 = 16; threshold 20; reorder yes.
Second row check: 31 + 0 - 12 = 19; threshold 18; reorder no.
Reject =B2+C2-E2 and =$B$2+C2-D2.Performance and operating cost
For N rows, recalculating a simple row-wise arithmetic formula is O(N) time and O(1) additional working space per row; the workbook application may retain N results. Testing two different rows catches a fixed-reference error that a single-row check cannot expose. Complex formulas and cross-sheet dependencies can have much higher recalculation cost, so benchmark against the real workbook when scale matters. The prompt itself cannot prove syntax compatibility across products, locales, or calculation modes. Keep the formula proposal and the engine-calculated result as separate review artifacts.
Common Mistakes
- Do not check only the first copied formula.
- Do not confuse a threshold with a reserved quantity because both are numeric columns.
- Do not treat a parsed formula as a correct business rule.
Connected lessons
- Prompt engineering applications
- Prompt Engineering
- Workbook prompts: name sheets, ranges, types, and provenance
- Aggregation prompts: pin the denominator and recompute the rate
- Locale-aware prompts: keep values typed until rendering
- Workbook edits: review a cell diff before applying changes
- Spreadsheet exports: keep untrusted labels as text
- Spreadsheet release checks: recalculate, reconcile, then inspect
- Project: review a depot replenishment workbook
- Spreadsheet prompt and workbook release decisions
