Power Query Problems

Use a Date Range in an Excel Microsoft Query Parameter

Phi Hung VoPhi Hung Vo Nov 20, 2026 869 views

Question details

Use a start date and an end date to filter an Excel Microsoft Query instead of passing two dates through a single parameter.

Product
Microsoft Excel Microsoft Query
Device & OS
not provided
Scenario
An existing query uses a worksheet cell as a date parameter, and the user wants to filter records by a date range.
Observed behavior
The query returns a syntax error after the reference cell is changed from one date to two dates.
Before you start

Identify the query's date column and enter the start and end dates in two separate worksheet cells. Check that both cells contain valid dates and that the start date is not later than the end date.

Solution 1Recommended

Change the query to use two date parameters

Use this approach when a query that previously matched one date needs to return records within a date range.

A single parameter normally supplies one value, so placing two dates in its reference cell does not automatically create a range. Use a between comparison with separate start and end parameters, or equivalent greater-than-or-equal-to and less-than-or-equal-to conditions.

1
Open the existing query

In Excel, select a cell in the query results and open the query or connection properties from the Data tab. Use the available edit-query option to open the query in Microsoft Query; menu names vary by Excel version.

2
Update the date criteria

In Microsoft Query, edit the criteria for the date column. Change the equal-to comparison to between and provide separate parameter placeholders for the start and end dates. If editing SQL, an equivalent condition is `DateColumn >= ? AND DateColumn <= ?`; use the actual column name and syntax required by the data source.

3
Bind the parameters to cells

Return the query to Excel, then open its connection or external data properties and select Parameters. Bind the first date parameter to the start-date cell and the second to the end-date cell. If prompted while editing the query, supply the dates in the format expected by the data source.

4
Refresh the results

Select Data > Refresh All and confirm that the returned records fall within the intended date range. If an error remains, check the parameter order, date values, and data-source date syntax.

Dates with times: An inclusive end-date comparison may exclude records later on that date if the column stores times. In that case, use a condition that is less than the day after the end date, with an appropriate end parameter.
Free Microsoft Office alternative

Work with Excel spreadsheets in WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and support for Microsoft Office formats, making it easy to move everyday spreadsheet work. It does not repair Excel Microsoft Query connections.

Open and edit Microsoft Excel XLS and XLSX filesReview and filter date-based spreadsheet dataUse a familiar interface for everyday spreadsheet tasksMove common Office documents into a lightweight workspace
microsoft office alternative - wps office

Frequently Asked Questions

Can I put both dates in one parameter cell?

A Microsoft Query parameter normally accepts one value. Put the start and end dates in separate cells and bind them to separate query parameters.

Where do I connect the query parameters to worksheet cells?

Select a cell in the query results, open the connection or external data properties from Excel's Data tab, and choose Parameters. The exact menu names depend on the Excel version and connection type.

Why are some records on the end date missing?

The source column may include times, while the end-date parameter represents midnight. Change the end condition to be less than the following day so records throughout the end date are included.

Why does the query still report a syntax error?

Check the SQL or criteria in Microsoft Query for the correct column name, two separate parameter placeholders, and date syntax supported by the data source. Also verify the parameter order and that both worksheet cells contain valid dates.