Translate plain English requests into Google Sheets QUERY

Transforms plain business questions into working Google Sheets QUERY formulas with correct syntax, quotation marks, and date formats.

Text prompt for ChatGPT and Claude

You get: Production Formula, formula Breakdown and common Pitfalls to Check

Prompt

Prompt
Act as a Google Sheets formula specialist. Convert the plain English reporting request pasted below into a production-ready QUERY formula.

Rules:
- Output the single formula ready to paste directly into Google Sheets.
- Handle date literals using the mandatory `date 'yyyy-mm-dd'` format if dates are involved.
- Ensure column letters use standard uppercase letters.
- Explain how each clause works in simple, plain terms.
- Highlight any potential breakages regarding mixed data types in columns.

Output format:
- Production Formula (in code block)
- Formula Breakdown (bullet points explaining SELECT, WHERE, ORDER BY, or LIMIT clauses)
- Common Pitfalls to Check

Here is my table structure and plain English request:

Example output

How the QUERY formula is builtEach clause of the formula and what it does
  1. A:E source rangeReferences the dataset including headers
  2. SELECT A, B, C, D, EReturns all columns from Deal Name through Revenue
  3. WHERE text filtersB = 'Closed-Won' AND C = 'West', single quotes required
  4. Date filterD >= date '2024-01-01' in ISO format
  5. ORDER BY D DESCNewest dates first
  6. Header count: 1Row 1 contains table headers

Example for: sales table A:E filtering for Closed-Won deals in West region after Jan 2024

  • Production Formula
=QUERY(A:E, "SELECT A, B, C, D, E WHERE B = 'Closed-Won' AND C = 'West' AND D >= date '2024-01-01' ORDER BY D DESC", 1)
  • Formula Breakdown
  • A:E: References the source dataset including headers.
  • SELECT A, B, C, D, E: Returns all columns from Deal Name through Revenue.
  • WHERE B = 'Closed-Won' AND C = 'West': Filters rows to match both exact text criteria. Single quotes are mandatory around text values.
  • AND D >= date '2024-01-01': Converts the comparison date into the required ISO string format used by the Google Visualization API.
  • ORDER BY D DESC: Sorts the matching records with newest dates first.
  • , 1: Explicitly tells Google Sheets that row 1 contains table headers.
  • Common Pitfalls to Check
    Column D must be formatted as genuine dates in your source sheet. The QUERY function ignores cells that do not match the dominant data type in a column.
Written by AI from this prompt. Your results will vary.

Paste your column list and your plain English question into ChatGPT, Claude, or Gemini. If your data contains blank rows or currency signs, ask the model to adjust the formula to ignore nulls or strip formatting.

Reuse it: Use in a workflowTurn into a skillAdapt in the builder

Excel & Spreadsheets

Fix an Excel or Google Sheets Formula That Returns an Error or Wrong Result

Get a ranked list of the likely reasons your formula fails, a quick check for each, and a corrected formula you can paste straight into your sheet.

Excel & Spreadsheets

Plan a Pivot Table That Answers a Specific Business Question

Get a pivot table plan mapping your fields to rows, columns, values and filters, with aggregation choices, data shape fixes and build steps.

Excel & Spreadsheets

Paste rows from Excel or Google Sheets and get numbered findings tied to exact figures, a trend table, data quality flags and the gaps that limit conclusions.

Excel & Spreadsheets

Write an Excel or Google Sheets Formula from Plain English

Get a ready-to-paste Excel or Google Sheets formula built for your version and columns, with a step-by-step walkthrough and one test case to check it.

Excel & Spreadsheets

Create an Automated Customer Cohort Retention Matrix in Excel

You receive a step-by-step guide to building a cohort retention matrix in Excel, including the exact formulas for calculating monthly retention rates from raw data.

Excel & Spreadsheets

Highlight matching values across two separate spreadsheet columns

Generate the exact conditional formatting formula and click-by-click instructions to mark duplicate values found across two columns.