Skip to main content

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.