Excel does not have a worksheet function named QUERY like Google Sheets does. In Microsoft 365 for Windows, use functions such as FILTER and SUMIFS for formula-driven results, or use Power Query to import, clean, combine, and reshape data through a repeatable process.
What the Google Sheets QUERY Function Does
Google Sheets’ QUERY function selects, filters, sorts, and summarizes a range using a query-language string. For instance, a Sheets user can ask for rows where a region is West, choose particular columns, or group records and total their values. Its compact syntax can make one formula perform several jobs at once.
That can lead Excel users to search for a direct equivalent. There is no built-in Excel worksheet function with the same name and syntax, and a Google Sheets QUERY expression cannot simply be pasted into an Excel cell. The best replacement depends on what the query is meant to do: return matching rows, calculate grouped totals, or prepare data for ongoing analysis.
Excel’s Closest Match: Power Query
Power Query is Excel’s built-in data import and transformation tool. Although its name includes “Query,” it is not a cell formula that recalculates as you type. Instead, you create a sequence of steps—such as filtering rows, changing data types, removing columns, or grouping records—and refresh the query to apply those steps to the source again.
On Excel for Microsoft 365 for Windows, a common way to start is to select a cell in a data range and choose Data > From Table/Range. If the range is not already an Excel table, Excel will prompt you to create one. In the Power Query Editor, use the column menus and ribbon commands to transform the data. When finished, choose Home > Close & Load to return the results to a worksheet.
Power Query is a strong choice when you repeat the same preparation work on updated files or need to combine data from several sources. For example, you might import monthly sales workbooks, standardize their column names, remove blank rows, append the records, and load one clean table. The next month, replace or add the source files and refresh the query rather than repeating every manual cleanup step.
Choose a Formula for Live Worksheet Results
If you want results to appear directly in cells and respond as source values change, formulas are often more convenient than Power Query. Excel for Microsoft 365 includes dynamic-array functions that can return multiple rows from one formula. The result spills into neighboring cells, so leave enough room below and to the right of the formula.
Suppose a worksheet has headers in row 1 and four columns of sample sales data in A1:D5: Date, Region, Product, and Sales. The four records are West/Tea/120, East/Coffee/90, West/Coffee/200, and West/Tea/80. With those headers in A1:D1 and records in A2:D5, enter this formula to return every West record:
=FILTER(A2:D5,B2:B5="West","No matches")
It returns three rows: the West sales of 120, 200, and 80, with all four columns retained. The third argument displays “No matches” if nothing meets the condition. FILTER is available in Microsoft 365 and Excel 2021 or later, but not in every older Excel edition.
To sort those matching rows by the fourth column, Sales, from largest to smallest, use this formula with the same A2:D5 layout:
=SORT(FILTER(A2:D5,B2:B5="West","No matches"),4,-1)
The result is the same three West records, ordered by sales as 200, 120, and 80. Here, SORT uses 4 to identify the fourth column of the filtered result and -1 to specify descending order. The formula is compact, but it does not modify the source data.
Use SUMIFS for Grouped Totals
A query that groups rows and calculates totals may be easier to reproduce with SUMIFS than with a filter. In the sample above, enter the label West in F2. With sales in D2:D5 and regions in B2:B5, this formula returns the West sales total:
=SUMIFS($D$2:$D$5,$B$2:$B$5,F2)
The result is 400: 120 + 200 + 80. To calculate totals for other regions, put their names in F3, F4, and so on, then fill the formula down. The criteria range and sum range remain fixed because of the dollar signs, while the reference to F2 adjusts by row.
This approach is useful for a small summary table, but it does not automatically create a unique list of every region. You can type the categories yourself, use a PivotTable, or—if you have Microsoft 365 or Excel 2021 or later—generate a distinct list with UNIQUE. For a larger summary with multiple measures or flexible grouping, a PivotTable or Power Query may be easier to maintain.
How to Choose Between Formulas and Power Query
Pick the tool based on the kind of result you need and how it should update:
- Use FILTER when you need a live list of rows that meet a condition, such as all orders from one region.
- Use SUMIFS when you need totals or other conditional calculations for known categories.
- Use a PivotTable when you want an interactive summary that users can rearrange by fields such as region, product, or month.
- Use Power Query when you regularly import, clean, append, or reshape source data before analysis.
These options are not mutually exclusive. A common workflow is to use Power Query to create a reliable cleaned table, then use PivotTables or formulas to analyze the loaded results. That separates data preparation from reporting and makes it clearer where a change should be made.
Important Differences from Google Sheets QUERY
The biggest difference is that Sheets’ QUERY combines selection, filtering, sorting, and aggregation in a query string, while Excel generally uses separate functions, PivotTables, or Power Query steps. There is no single Excel formula that accepts the same query-language syntax and reproduces every QUERY operation.
There is also a difference in how results are maintained. A dynamic-array formula recalculates when its referenced worksheet values change. A Power Query result is typically updated by refreshing the query; it is not a live view of every edit made to the source. That refresh-based design is useful for repeatable imports, but it matters if someone expects an output table to change immediately after typing in the source.
Power Query is not simply “Excel’s SQL function.” It can connect to databases and other sources, but its transformation steps are managed in the query editor and expressed in the M language. Database connections may use SQL or another connector-specific mechanism, but that is different from writing a Google Sheets QUERY formula in a cell.
Common Problems and Practical Fixes
Formula-based alternatives can fail for reasons that are easy to overlook. If FILTER returns an error or an unexpected result, check that the condition range and data range cover the same number of rows. For example, a range A2:D100 must be paired with a condition range such as B2:B100, not B2:B99. Also check for extra spaces or inconsistent spellings in the source values.
If a dynamic-array formula displays #SPILL!, another value or a merged cell may be blocking the cells where the result needs to appear. Clear the output area or move the formula. If the formula itself is not recognized, the Excel edition may not support that function; older versions may need a filter, PivotTable, or helper-column approach instead.
For Power Query, a refresh error may indicate that a source file moved, a column was renamed, or the incoming data type changed. Review the query’s Applied Steps in the editor to find where the sequence breaks. Stable source names and consistent column headings make refreshes more dependable. On Mac and Excel for the web, Power Query support and available connectors or editing features can differ from Windows desktop, so check the tools available in your specific Excel version.
Frequently Asked Questions
Does Excel have a QUERY function like Google Sheets?
No. Excel has no built-in worksheet function named QUERY that uses Google Sheets’ query syntax. Use formulas, a PivotTable, or Power Query depending on the task.
What is the closest Excel equivalent to Google Sheets QUERY?
For importing and transforming data, Power Query is often the closest overall tool. For a formula that returns matching rows, FILTER is a closer fit. No single option duplicates every QUERY capability.
Can I use a Google Sheets QUERY formula in Excel?
Not directly. Excel will not interpret the Sheets QUERY language as an Excel formula. Rebuild the result with Excel functions, a PivotTable, or Power Query.
Does Power Query update automatically when my source changes?
Normally, you refresh a query to load updated source data. This differs from a worksheet formula that recalculates when referenced cells change. Refresh options and connections depend on the source and workbook setup.
Can Excel FILTER replace QUERY?
It can replace the row-filtering part of many queries, and it can return matching rows dynamically. It does not by itself handle every task, such as all types of grouped summaries or multi-source data cleanup.
Bottom Line
There is no direct Excel QUERY function, but most common Sheets query tasks have a practical Excel counterpart. Start with FILTER for matching rows, SUMIFS for conditional totals, and Power Query for repeatable data preparation. Choosing according to the task—and whether the result should recalculate or refresh—will usually produce a simpler, more dependable workbook than trying to imitate QUERY with one oversized formula.
Related
- Power Query Current Date: Get Today’s Date in Power Query
- Excel Text on a New Line in the Same Cell: A Guide
- Excel Text Box Linked to Cell: Setup, Uses, and Fixes
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Excel Formula for Row Number: ROW and ROWS ExplainedTo return the worksheet row number of the cell containing a formula, use =ROW(). To return the row…
- Split a Cell in Excel: Text to Columns, Formulas, and MoreYes. In Microsoft Excel, select the cells and choose Data > Text to Columns to split their contents…
- Excel HLOOKUP: Return a Column NumberHLOOKUP does not return the number of the column where it finds a match; it returns a value…
- VLOOKUP Examples Using Two SpreadsheetsTo look up a value in a separate Excel workbook, put the lookup key in your current sheet…
- Excel Find and Replace Within a Formula: Steps and TipsYes. In Excel for Microsoft 365 on Windows, press Ctrl+H, open Options if needed, set Look in to…
- Excel Day Timeline: Build a Daily Schedule or Date FilterAn Excel day timeline can mean either a daily schedule laid out across worksheet columns or a PivotTable…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.