0

Example — Excel Formula Builder

Demonstration of prompts/files-data/excel-formula.txt with the variables filled in. Illustrative example of what such a prompt can produce. The response was generated by an AI in one pass — not guaranteed, and not professional advice. All names, n

Prompt · برومبتexcel

Works with

claude-code (compatible), claude (compatible), codex (compatible), chatgpt (compatible), gemini-cli (compatible), cursor (compatible), copilot (compatible), opencode (compatible), amp (compatible), roo (compatible), kiro (compatible), goose (compatible), junie (compatible), trae (compatible), cline (compatible), continue (compatible), antigravity (compatible), windsurf (compatible), augment (compatible), qwen-code (compatible), aider (compatible)

Content

Example — Excel Formula Builder

Demonstration of [prompts/files-data/excel-formula.txt](../prompts/files-data/excel-formula.txt) with the variables filled in. Illustrative example of what such a prompt can produce. The response was generated by an AI in one pass — not guaranteed, and not professional advice. All names, numbers, and details are fictional (Egypt-plausible where relevant).

Prompt (filled)

You are a spreadsheet expert (Excel and Google Sheets). Translate my plain-words goal into the exact formula, then explain it so I can modify it myself next time.
MY DETAILS
- Tool and version (Excel 2019/365, Google Sheets): Excel 365
- What I want it to do (in plain words): total sales per salesperson per month with a dropdown picker
- My sheet layout (columns and their headers, sample rows): A: date, B: salesperson, C: amount, D: region (data on sheet "Sales", summary on sheet "Summary")
- Edge cases in my data (blanks, text mixed with numbers, duplicates): some amounts blank, names with extra spaces
YOUR TASK — answer in this exact order:
1. THE FORMULA: the exact formula referencing MY columns from A: date, B: salesperson, C: amount, D: region (data on sheet "Sales", summary on sheet "Summary"), ready to paste.
2. HOW IT WORKS: the formula explained piece by piece — each function in one plain line.
3. EDGE CASES HANDLED: how the formula behaves with my some amounts blank, names with extra spaces (blanks, errors, no-match) and the wrapper (IFERROR/IF) if needed.
4. ALTERNATIVE: one simpler or better approach if one exists (a pivot table, a built-in feature), with when to prefer it.
5. TEST ROWS: 3 example inputs and what the formula should return, so I can verify immediately.
RULES
- Input-complete prompt: if the pasted material is unreadable or clearly incomplete, say exactly what is missing instead of proceeding on assumptions.
- Use my real column letters/headers from A: date, B: salesperson, C: amount, D: region (data on sheet "Sales", summary on sheet "Summary") — never generic A1 dummy references unless my layout is incomplete (then say what I must tell you).
- One formula per problem; no mega-nested monsters when a helper column is cleaner.
- If my goal needs a script or pivot rather than a formula, say so plainly.
OUTPUT FORMAT
- Five numbered sections: paste-ready formula referencing my columns, piece-by-piece explanation, edge-case behavior, alternative approach, 3 test rows with expected results. Lead with THE FORMULA.

Example AI response

1. THE FORMULA On the Summary sheet, put the chosen month in B1 (format it as a date, e.g. Jan-2026) and the salesperson name in B2:

=SUMIFS(Sales!C:C, Sales!B:B, "*"&TRIM(B2)&"*", Sales!A:A, ">="&B1, Sales!A:A, "<"&EDATE(B1,1))

For the dropdown: select B2 → Data → Data Validation → List → source =Sales!$B$2:$B$500 (or a separate hidden list of unique names).

2. HOW IT WORKS

  • SUMIFS — adds the values in Sales!C:C but only for rows matching every condition.
  • Sales!B:B, "*"&TRIM(B2)&"*" — matches the salesperson name ignoring the extra spaces in your data (TRIM cleans the picker value; the wildcards absorb stray spaces in the Sales sheet).
  • Sales!A:A, ">="&B1 — only rows on or after the first day of the chosen month.
  • Sales!A:A, "<"&EDATE(B1,1) — only rows before the first day of the *next* month (EDATE adds one month), so month lengths don't matter.

3. EDGE CASES HANDLED

  • Blank amounts: SUMIFS treats them as 0 — no error, they're just skipped.
  • Names with extra spaces: handled both sides (TRIM + wildcards).
  • Wrong month picked (no matching rows): returns a clean 0, not an error. If you'd rather see "No data": =IF(SUMIFS(...) = 0, "No data", SUMIFS(...)) — repeat the SUMIFS inside.

4. ALTERNATIVE A PivotTable (Insert → PivotTable → rows: salesperson, columns: date grouped by month, values: sum of amount) plus a slicer does this with zero formulas and refreshes in one click. Prefer the formula when you need the number inside other calculations; prefer the pivot when the Summary sheet is for reading only.

5. TEST ROWS

| Sales sheet row | Expected result with B1=Jan-2026, B2=" Hoda " | |---|---| | 2026-01-10 · "Hoda" · 5000 | counted → +5,000 | | 2026-01-15 · " Hoda " · 2500 | counted (wildcard match) → +2,500 | | 2026-02-02 · "Hoda" · 9000 | ignored (wrong month) |

Total returned: 7,500.

--- *Generated for demonstration as part of Prompt Stash. Outputs vary by model and run.*

Source and license

Source
Prompt Stash
Original
Ziadtareks/prompt-stash/examples/files-data-excel-formula.md
License
MIT