Google Sheets formula workflow

Google Sheets QUERY Date Filter Formulas

Direct answer: Google Sheets QUERY dates must use date 'yyyy-mm-dd' inside the query string, or TEXT(date_cell,"yyyy-mm-dd") when the boundary comes from a cell. Use this page to copy the correct patterns for one date, a date range, a date cell, TODAY, current month, DATETIME values, and FORMAT clauses without relying on locale-specific display dates.

Key point

Google Sheets QUERY date filters must use the date 'yyyy-mm-dd' syntax inside the query string.

Copy-paste formulas

Static single date
=QUERY(A1:D, "select * where A = date '2026-01-15'", 1)

Use this when the source date column contains date-only values.

Between two static dates
=QUERY(A1:D, "select * where A >= date '2026-01-01' and A < date '2026-02-01'", 1)

This returns January rows with a timestamp-safe upper boundary.

Dates from cells
=QUERY(A1:D, "select * where A >= date '"&TEXT(F1,"yyyy-mm-dd")&"' and A < date '"&TEXT(G1,"yyyy-mm-dd")&"'", 1)

Use this when F1 and G1 contain real Google Sheets dates.

Inclusive end date cell
=QUERY(A1:D, "select * where A >= date '"&TEXT(F1,"yyyy-mm-dd")&"' and A < date '"&TEXT(G1+1,"yyyy-mm-dd")&"'", 1)

Use this when G1 is the last visible date to include.

QUERY Date Formula Generator

Enter your range, date column, date boundaries, and header count to generate a copyable Google Sheets QUERY date formula.

Include the header row if your header rows value is 1.
Use the QUERY column letter, such as A or Col1 depending on your range.
Use an ISO date or a date cell such as F1.
Use an ISO date or a date cell such as G1.
Use 1 when the first row contains headers.

Formula is valid and ready to copy.

Generated QUERY formula
=QUERY(A1:D, "select * where A >= date '2026-01-01' and A <= date '2026-01-31'", 1)
Explanation
This QUERY formula filters rows by comparing the date column with QUERY date literals.

Quick syntax

A fixed date must be written as date 'yyyy-mm-dd' inside the query string.

A date cell must be converted with TEXT(F1,"yyyy-mm-dd") before it is concatenated into the query string.

Static single date
=QUERY(A1:D, "select * where A = date '2026-01-15'", 1)

Use this when the date column stores date-only values.

Query one date

Use a single date filter only when the source column contains date-only values. If it includes times, use a start and next-day boundary instead.

Exact date
=QUERY(A1:D, "select * where A = date '2026-01-15'", 1)

This can miss timestamp values on the same day.

Query between two dates

A date range should use a lower boundary and an exclusive upper boundary. This keeps the formula reliable when source values include times.

Date range with static dates
=QUERY(A1:D, "select * where A >= date '2026-01-01' and A < date '2026-02-01'", 1)

This returns January rows and excludes February rows.

Query dates from cells

When a start or end date lives in a cell, concatenate it into the query string with TEXT so QUERY receives the literal format it expects.

Date range from cells
=QUERY(A1:D, "select * where A >= date '"&TEXT(F1,"yyyy-mm-dd")&"' and A < date '"&TEXT(G1,"yyyy-mm-dd")&"'", 1)

F1 and G1 should contain real Google Sheets dates.

Include the visible end date

When G1 is the last day users want to include, add one day to G1 and keep the < operator.

This is safer than <= G1 because date-time values later on the end date are still included.

End date cell included
=QUERY(A1:D, "select * where A >= date '"&TEXT(F1,"yyyy-mm-dd")&"' and A < date '"&TEXT(G1+1,"yyyy-mm-dd")&"'", 1)

Use this when the end-date input is 2026-01-31 instead of the next boundary 2026-02-01.

Fix invalid date literal from a cell reference

A common error is writing date 'F1' or date 'Sheet2!C6'. QUERY reads that as the literal text F1, not as the value stored in the cell.

Keep the date keyword inside the query string, then leave the string, convert the cell with TEXT, and rejoin the query string.

Single date from a cell
=QUERY(A1:D, "select * where A = date '"&TEXT(F1,"yyyy-mm-dd")&"'", 1)

Use this when F1 contains the date to match.

Date from another sheet cell
=QUERY(Sheet1!A1:D, "select * where A = date '"&TEXT(Sheet2!C6,"yyyy-mm-dd")&"'", 1)

The cell reference stays outside the quoted query string.

Query today, this month, and rolling windows

Use TODAY and EOMONTH through TEXT to build dynamic QUERY date boundaries that update every day.

Current month
=QUERY(A1:D, "select * where A >= date '"&TEXT(EOMONTH(TODAY(),-1)+1,"yyyy-mm-dd")&"' and A < date '"&TEXT(EOMONTH(TODAY(),0)+1,"yyyy-mm-dd")&"'", 1)

This returns rows from the first day of this month through the first day of next month.

Last 7 days
=QUERY(A1:D, "select * where A >= date '"&TEXT(TODAY()-7,"yyyy-mm-dd")&"' and A < date '"&TEXT(TODAY()+1,"yyyy-mm-dd")&"'", 1)

The upper boundary includes today through tomorrow's start.

Query DATETIME and TIMEOFDAY values

Use datetime when your boundary cell includes both date and time. Use timeofday only when the column stores time values without a separate date.

DATETIME boundary
=QUERY(A1:D, "select * where A >= datetime '"&TEXT(F1,"yyyy-mm-dd HH:mm:ss")&"'", 1)

Use this when F1 contains a real date and time value.

TIMEOFDAY boundary
=QUERY(A1:D, "select * where A >= timeofday '"&TEXT(F1,"HH:mm:ss")&"'", 1)

Use timeofday only for time-only source values.

Use FORMAT to display dates

The FORMAT clause changes how returned dates display. It does not change the source values used by WHERE filtering.

FORMAT date output
=QUERY(A1:D, "select A, B format A 'yyyy-mm-dd'", 1)

Use FORMAT after SELECT or WHERE when you want consistent date display in the result.

Common QUERY date errors

Blank results usually mean the query string received a display date, text date, direct cell reference, or an end date that misses timestamp rows.

Fix the WHERE date logic first. FORMAT only changes output display after the filter has already run.

When not to use QUERY date formulas

Use FILTER when you only need matching rows in the same column layout and do not need SELECT, FORMAT, GROUP BY, or ORDER BY.

Use SUMIFS or COUNTIFS when the goal is a monthly total or count instead of returned rows.

Sample data for QUERY date formulas

DateRegionProductAmount
2026-01-04EastWidget420
2026-01-12WestWidget310
2026-02-03EastGadget275
2026-02-15EastWidget640

Returned results from the sample data

Formula patternReturned resultBoundary note
A = date '2026-01-15'Returns no rows from the sample because no row has exactly that date.Use equality only for date-only columns with known matching dates.
A >= date '2026-01-01' and A < date '2026-02-01'Returns the two January rows: 2026-01-04 and 2026-01-12.The exclusive upper boundary excludes February rows.
A >= date '2026-02-01' and A < date '2026-03-01'Returns the two February rows: 2026-02-03 and 2026-02-15.Use the first day of the next month as the upper boundary.
A >= date from F1 and A < date from G1Returns the same rows as the fixed-date version when F1 and G1 hold those dates.TEXT converts date cells before QUERY parses them.
A >= date from F1 and A < date from G1+1Includes rows on the visible end date entered in G1.Use when G1 is the last day to include rather than the next boundary.

Common QUERY Date Errors

Error / SymptomLikely CauseFix
QUERY returns blank rowsThe formula uses a display date or text date instead of a date literal.Use date 'YYYY-MM-DD' or TEXT(date_cell,"yyyy-mm-dd").
Date looks correct but QUERY does not matchThe sheet displays a date, but the query string receives text or a locale-specific value.Convert cell dates with TEXT and confirm the source column contains real dates.
Invalid date literal such as F1 or Sheet2!C6The cell reference was typed inside date quotes, so QUERY received text instead of the cell value.Use date '"&TEXT(F1,"yyyy-mm-dd")&"' or date '"&TEXT(Sheet2!C6,"yyyy-mm-dd")&"'.
Invalid date literal such as 44713A real date cell was concatenated directly, so QUERY received the serial number rather than yyyy-mm-dd text.Wrap the cell with TEXT(date_cell,"yyyy-mm-dd") before concatenating it into the query.
Date column contains timestampsExact date equality does not match values with time portions.Use a start boundary and an exclusive next-day upper boundary.
Locale date format issueDates such as 1/2/2026 can mean different days in different locales.Use ISO-style date literals in the query string.
Wrong header row countThe third QUERY argument does not match the source header rows.Use 1 for one header row or 0 when the source range has no header row.
FORMAT changes display but not source valueFORMAT is applied after filtering and does not repair invalid WHERE dates.Fix the WHERE date syntax first, then add FORMAT for display.

Related tools and guides

FAQ

Why does Google Sheets QUERY return blank with dates?

QUERY can return blank rows when the formula uses display dates such as 1/1/2026 instead of QUERY date literals such as date '2026-01-01'.

How do I query between two dates?

Use a lower boundary and an exclusive upper boundary, for example A >= date '2026-01-01' and A < date '2026-02-01'.

How do I use a cell date in QUERY?

Concatenate the date cell with TEXT(F1,"yyyy-mm-dd") so the query string receives a valid date literal.

Why does date 'F1' or date 'Sheet2!C6' fail in QUERY?

QUERY treats text inside date quotes as a literal date, not as a spreadsheet reference. Use date '"&TEXT(F1,"yyyy-mm-dd")&"' so the referenced cell is converted before the query string runs.

How do I use TODAY in a QUERY date formula?

Use TEXT(TODAY(),"yyyy-mm-dd") inside the query string. For timestamp columns, use a range from today to tomorrow.

Should I use <= end date or < next day?

Use < the next day or next month when the source column may include time values. It avoids missing rows later on the displayed end date.

How do I query the current month?

Use EOMONTH(TODAY(),-1)+1 for the first day of this month and EOMONTH(TODAY(),0)+1 for the first day of next month.

How do I format dates in QUERY results?

Add a FORMAT clause such as format A 'yyyy-mm-dd'. FORMAT changes the displayed output, not the source date value used by WHERE.