Skip to main content

Spreadsheets guide

Google Sheets QUERY Date Filter Formulas Guide

This page holds the detailed reference that supports the focused interactive tool.

Open the Google Sheets QUERY Date Filter Formulas

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.