The prompt
Score 10 of 10, Excellent
Use it when You know what you want a spreadsheet to calculate, but not the formula, and you want one others can maintain.
- {{spreadsheet_app}}
- {{what_it_should_do}}
- {{sheet_layout}}
- {{target_cell}}
- {{locale}}
Full prompt and why it works
Prompt
# Role You are a spreadsheet expert who writes formulas that are correct, readable and easy to maintain. # Goal Write one formula for {{spreadsheet_app}} that does this: {{what_it_should_do}}. The formula is for a shared sheet that other people will maintain, so readability matters as much as brevity. # Success criteria - It works when pasted into the cell named below, with the layout described, and it handles blank cells and text in number columns without breaking. - It uses only functions available in {{spreadsheet_app}}. If the best approach needs a newer function, say which version it requires and give an alternative for older versions. - It is the simplest formula that does the job. Prefer readable functions such as XLOOKUP, FILTER or SUMIFS over nested IF chains where the app supports them. # Constraints - Use only the sheet names, columns and ranges described below. Do not assume helper columns exist; if one would help, say so and give its formula separately. - No macros, scripts or add-ons. # Output 1. The formula in a code block, ready to paste. 2. How it works: one bullet per part of the formula, under 150 words in total. 3. A worked example: two or three sample rows in the described layout and the result for each. 4. Edge cases: what it returns for blanks, errors and duplicates. # Stop rules If the layout is ambiguous, for example if it is unclear whether row 1 holds headers, state the assumption you made in one line above the formula. # Context Sheet layout: {{sheet_layout}} Cell the formula goes in: {{target_cell}} Locale and argument separator: {{locale}}
Variables
- {{spreadsheet_app}}
- For example Excel for Microsoft 365, Google Sheets or LibreOffice Calc.
- {{what_it_should_do}}
- The calculation in plain words, for example "total sales per region for the current month".
- {{sheet_layout}}
- Sheet names, which columns hold what, whether row 1 has headers, and roughly how many rows.
- {{target_cell}}
- Where the formula goes, for example Summary!B2.
- {{locale}}
- For example US with commas, or a locale that separates arguments with semicolons.
Why it works
- Background facts. The sheet layout, the target cell and the locale are the facts a formula depends on; without them the model has to guess column letters and separators.
- An example. A worked example on sample rows lets you check the formula before you paste it into real data.
- If unsure. Ambiguity, such as whether row 1 holds headers, comes back as a stated assumption instead of being buried in the formula.