Excel Equivalent to Google Sheets QUERY and How to Use It

How-to basics · Updated November 3, 2026

Excel Equivalent to Google Sheets QUERY and How to Use It

Excel has no single built-in function that works exactly like Google Sheets’ QUERY. For a one-off filtered or sorted result, use dynamic-array functions such as FILTER and SORT; for repeatable data-cleaning and grouping steps, use Power Query, found under Data > Get Data in Excel for Microsoft 365 on Windows.

What Google Sheets QUERY does

Google Sheets’ QUERY function combines several kinds of data operations in one formula. Its query-language text can select columns, filter rows with conditions, sort results, group records, calculate aggregates, and limit the number of returned rows. For example, a query can show sales by product for one region, ordered from highest to lowest.

That range of jobs is why there is no exact one-for-one Excel replacement. Excel divides them among worksheet functions, PivotTables, Power Query, and—in some data-connection situations—SQL. The right match depends on whether you want a live formula result, a report you refresh, or a query against a database.

One important distinction: Google Sheets QUERY is a spreadsheet function with its own query language. Power Query is Excel’s data-import and transformation tool; it is not a worksheet function and it does not use Google’s QUERY syntax. Its interface lets you apply transformations, and it records those steps in the Power Query M language.

The closest Excel equivalent depends on the task

For a small range already on a worksheet, Excel formulas are often the most direct option. FILTER returns rows matching a condition, SORT changes their order, UNIQUE returns distinct values, and functions such as SUMIFS calculate totals by criteria. These functions can recalculate as source values change.

For a multi-step process—such as importing a file, removing unwanted rows, changing data types, grouping records, and loading the result—Power Query is usually the closer practical counterpart. It saves transformation steps so you can refresh the output when the source data changes. It is particularly useful when the same cleanup must be repeated.

A PivotTable is often simpler if the main goal is to summarize values by category and let readers rearrange the report. If the source is a database, a connector may also support a native SQL statement. That is database querying, though, not a general Excel-cell formula equivalent to QUERY.

Re-create common QUERY tasks with formulas

The examples below assume a sales list with product names in A2:A100, regions in B2:B100, and sales amounts in C2:C100. In a small illustrative sample, Widget is West with sales of 120, Gadget is East with 60, Cable is West with 80, and Stand is West with 150. The formulas use commas as argument separators, as in standard Microsoft 365 for Windows installations; regional settings can affect separators.

To return all columns for West-region records, with products in A2:A100, regions in B2:B100, and sales in C2:C100, use:

=FILTER(A2:C100,B2:B100="West","No rows")

With the four sample records above, this spills three rows: Widget, Cable, and Stand, with their regions and sales. The third argument displays “No rows” if the condition finds no matches. FILTER is available in Microsoft 365 and Excel 2021 or later; it is not supported in older perpetual versions such as Excel 2019.

To sort those matching rows by the third column, sales, from highest to lowest, with the same column layout, use:

=SORT(FILTER(A2:C100,B2:B100="West","No rows"),3,-1)

The sample results appear in this order: Stand (150), Widget (120), then Cable (80). SORT’s second argument identifies the sort column within the filtered array, and -1 requests descending order. SORT is available in Microsoft 365 and Excel 2021 or later.

To total sales for West, with regions in B2:B100 and sales in C2:C100, use:

=SUMIFS(C2:C100,B2:B100,"West")

For the sample, the result is 350: 120 + 80 + 150. SUMIFS is a useful match for grouped totals when you need a particular category’s aggregate, though it does not automatically produce a whole summary table of every category.

To list distinct region names, with regions in B2:B100, use:

=UNIQUE(B2:B100)

The illustrative sample returns West and East, in the order they first appear. UNIQUE is available in Microsoft 365 and Excel 2021 or later. For older Excel versions, a PivotTable or the Remove Duplicates command may be a better fit, depending on whether you need a dynamic list or a one-time cleanup.

Use Power Query for repeatable transformations

Power Query is built into Excel for Microsoft 365. On Windows, you can start with a range by selecting a cell in the data and choosing Data > From Table/Range. If Excel asks, confirm whether the table has headers. The Power Query Editor opens with a preview of the data.

From there, use the controls in the editor to filter rows, remove or choose columns, sort, change data types, and group records. For example, to create a West-only sales summary by product, filter the Region column to West, then use Home > Group By, select Product as the grouping field, and choose Sum for the Sales column. When the transformation is ready, choose Home > Close & Load to return the result to Excel.

Power Query stores the transformation sequence, so you can refresh rather than manually repeat each cleanup step. In Excel, refresh the query from Data > Refresh All. The output is generally loaded as a table, not as a formula that spills into neighboring cells. If the source file’s layout changes substantially, the saved steps may need adjustment.

Power Query is available in Microsoft 365 for Mac too, but connectors and capabilities can differ from Windows, and menu details may vary by release. Excel for the web has some Power Query support, but its editing and connector options are not identical to the Windows desktop application. If a particular connector or transformation is missing, check the current options for that platform rather than assuming every Windows workflow will transfer unchanged.

Translate the operation, not just the syntax

A useful way to convert a Sheets QUERY is to break its query text into actions and choose an Excel tool for each action. A query like “select product, sum(sales), where region is West, group by product, order by total descending” describes at least four operations: filter, group and aggregate, select output fields, and sort. Power Query can perform those steps as a saved transformation; a PivotTable can summarize and sort the results; formulas can build a more tailored output.

For example, if the report is for occasional analysis, a PivotTable may require fewer steps than building a formula-based summary. Select the source data and choose Insert > PivotTable, then place Product in Rows, Sales in Values, and Region in Filters. Filter Region to West and sort the totals as needed. Excel may label the summarized Sales field “Sum of Sales”; check that it is summarized by Sum rather than Count if the source contains numbers.

There is also a difference in how results update. Formula outputs can respond immediately to changed cells within their referenced ranges. Power Query output updates when refreshed. A PivotTable also needs refreshing when its source changes, unless the change is handled by its source table and refresh settings. These are not interchangeable update models, so choose based on how fresh the report must be and how the workbook will be used.

Choosing between formulas, Power Query, and PivotTables

  • Choose formulas for a live result on a worksheet, a compact filtered list, or a custom calculation that should update as inputs change.
  • Choose Power Query for recurring imports, cleanup, combining files or tables, and a recorded sequence of data-preparation steps.
  • Choose a PivotTable for interactive summaries by category, especially when readers need to rearrange fields or inspect totals.
  • Use a database connector or SQL when the data is held in a database and the connector supports the query you need.

There is no requirement to pick only one approach. A common workflow is to use Power Query to clean and load data, then use a PivotTable or formulas for the report. Keeping the raw input, transformation, and presentation separate can make a workbook easier to audit and maintain.

Common limitations and mistakes

First, do not expect to paste Google Sheets’ QUERY text into Excel and have it run. Excel will not interpret clauses such as select, where, or group by as a worksheet formula language. Rebuild the logic with Excel features instead.

Second, formula compatibility matters. FILTER, SORT, and UNIQUE need Microsoft 365 or Excel 2021 or later. In an older Excel edition, a formula copied from a newer workbook may show a name error or fail to return an array. Check the Excel version used by everyone who must open the file.

Third, make sure your data types are consistent. A sales column imported as text may not sum correctly, and dates stored as text may sort alphabetically instead of chronologically. In Power Query, set the data type deliberately; in a worksheet, inspect the source values and correct the underlying data rather than relying on display formatting alone.

Finally, avoid unnecessarily large full-column array formulas if a bounded range or Excel Table will do. Tables expand as rows are added, can make formulas easier to read, and are useful as Power Query sources. Also remember that a formula’s “live” behavior does not mean it automatically includes new rows when its references are fixed to an old range.

Frequently Asked Questions

Does Excel have a QUERY function like Google Sheets?
No. Excel does not include a worksheet function with the same name and combined behavior. Use FILTER and related formulas for formula-driven results, or use Power Query, PivotTables, and database tools for other query tasks.

What is the closest Excel formula to Google Sheets QUERY?
FILTER is the closest match when the main task is returning rows that meet conditions. It does not by itself reproduce QUERY’s grouping, aggregation, sorting, and selection features; combine functions or choose Power Query or a PivotTable when those are needed.

Can Power Query replace Google Sheets QUERY?
It can replace many recurring data-transformation workflows, including filtering, grouping, and sorting, but it is a separate tool rather than a drop-in formula replacement. Its output is refreshed, while a worksheet formula normally recalculates as referenced inputs change.

Can I use SQL in Excel?
Some database connectors allow a native SQL statement when connecting to a supported source. That option depends on the connector and data source; it does not make SQL a general way to query arbitrary worksheet ranges.

What should I use in older Excel versions without FILTER?
For a summary, try a PivotTable; for data cleanup, use Power Query if it is available in your Excel release. Older versions may also support other formula methods, but they can be less straightforward and may require special array-formula handling.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.