thinkhard.SI

Prompt repository Data & spreadsheets

Fix a spreadsheet formula that shows an error or the wrong result

A formula returns #N/A, #VALUE!, #SPILL! or a number you know is wrong, and you need the cause, the fix and a way to confirm it.

Registry no.
DAT-018
Collection
Data & spreadsheets
Laid out for
Any chat model
Score
10 out of 10
Blanks to fill
6
Added

Data & spreadsheetsAny chat

The prompt

Score 10 of 10, Excellent

Use it when A formula returns #N/A, #VALUE!, #SPILL! or a number you know is wrong, and you need the cause, the fix and a way to confirm it.

  • {{app_and_version}}
  • {{formula}}
  • {{what_it_shows}}
  • {{expected_result}}
  • {{who_uses_it}}
  • {{sample_data}}
Full prompt and why it works
Prompt
App and version: {{app_and_version}}
The formula, copied exactly, and the cell it is in: {{formula}}
What it shows: {{what_it_shows}}
What it should show, and how I know: {{expected_result}}
Who relies on this sheet: {{who_uses_it}}

The cells the formula refers to, with a few sample rows (headers, values as they appear, and any rows I suspect):
"""
{{sample_data}}
"""

Task:
Find out why the formula above gives the wrong result in {{app_and_version}} and give me a fixed version, so that I can repair a sheet {{who_uses_it}} rely on. I want the cause explained, not just a new formula, so I can spot the same problem next time.

Format:
1. Most likely cause: one or two sentences pointing to the part of the formula or the cell responsible.
2. Other possible causes, most likely first, each with a quick test in the sheet to rule it in or out. Common ones: numbers or dates stored as text, extra spaces, a range that misses some rows, a reference that shifted when copied (missing $ signs), an exact or approximate match setting, cells blocking a spill, or a function this version does not have.
3. The fixed formula in a code block, ready to paste, changed as little as possible.
4. What changed: each change in one plain sentence.
5. Check it: two or three of my sample rows with the result the fixed formula should give, worked out by hand, so I can compare.

Requirements:
- Under 350 words, plus the formula.
- Use only functions available in {{app_and_version}}.
- Do not wrap the formula in IFERROR to hide the error unless the error is expected for some rows, and say why if you do. A hidden error leaves a wrong number in place.
- If the fix needs the data cleaned (for example text converted to numbers), give that step separately rather than burying it in the formula.

Example of one check row's form only: "Row 4: ID 1042 is in the price list, so the fixed formula returns 18.50."

If my sample does not show the problem, say what else to paste, for example the cell's number format or the first rows of the lookup table.

Variables

{{app_and_version}}
For example "Excel for Microsoft 365", "Excel 2016" or "Google Sheets".
{{formula}}
The formula exactly as it appears in the formula bar, and its cell, for example "=VLOOKUP(A2,Prices!A:B,2,FALSE) in Orders!F2".
{{what_it_shows}}
For example "#N/A on about half the rows" or "a total of 0".
{{expected_result}}
The right answer for at least one row and how you know, for example "F2 should be 18.50, from the price list".
{{who_uses_it}}
For example "the whole sales team" or "just me".
{{sample_data}}
Headers and five to ten rows of the cells involved, copied as they appear, with personal data removed.

Why it works

  • If unsure. Possible causes come with a quick test to rule each in or out, and if the sample does not show the problem, it asks for what it needs instead of guessing.
  • What to avoid. It will not hide the error with IFERROR unless the error is expected, because a hidden error leaves a wrong number in the sheet.
  • What good looks like. Two or three sample rows worked out by hand let you confirm the fix in the sheet before you trust it.

How to use it

  1. Press Fill in variables and type your details into each blank. What you type stays in this browser.
  2. Copy the filled prompt into the AI tool you already use, such as ChatGPT, Claude or Gemini, or open it in the Grader or the Prompt Tester here.
  3. Before you rely on it, try it on three or four real examples. The Prompt Tester runs them all at once and shows which ones go wrong.
Use it from code

Get this prompt as JSON from the free REST API, with your own text in the blanks, or let an AI assistant fetch it through the MCP server. No key.

curl -s https://thinkhard.si/api/v1/prompts/fix-spreadsheet-formula-error

With the MCP server added to Claude, ChatGPT, Cursor or VS Code, call get_prompt with {"prompt": "fix-spreadsheet-formula-error"}, or just ask for it by name.