The closest Excel equivalent to Google Sheets’ QUERY function is a combination of dynamic-array functions such as FILTER, SORT, and UNIQUE, plus SUMIFS or PivotTables for summaries. Excel has no single built-in QUERY function with the same query-language syntax; for repeatable data-cleaning and transformation steps, Power Query is often the stronger alternative.
Why Excel has no direct QUERY equivalent
Google Sheets QUERY lets you describe a data operation in a text string: select columns, filter rows, sort, group, aggregate, or limit results. It is based on the Google Visualization API Query Language. Excel takes a different approach. It provides individual worksheet functions for calculations and filtering, plus tools such as PivotTables and Power Query for broader analysis and transformation.
That difference matters because there is no one-for-one translation for every QUERY statement. A simple WHERE condition may translate neatly to FILTER, while a query that groups by several fields, calculates multiple aggregates, changes column labels, and sorts the result may be easier to build with a PivotTable or Power Query. Think of the Excel equivalent as a set of tools chosen according to the job, rather than a function with a different name.
The examples below use Microsoft Excel for Microsoft 365 on Windows. Dynamic-array functions such as FILTER, SORT, and UNIQUE are also available in Excel 2021 and later. Some newer functions mentioned below require Microsoft 365 or Excel 2024.
Choose the Excel tool that matches the query
- Filter records by conditions: use FILTER to return matching rows into a new area.
- Sort or remove duplicates: combine SORT and UNIQUE with a filtered result where appropriate.
- Calculate totals by category: use SUMIFS, COUNTIFS, or AVERAGEIFS, or create a PivotTable.
- Select or rearrange columns: use CHOOSECOLS with a dynamic-array result, or set the output columns in Power Query.
- Repeat a multi-step cleanup: use Power Query to record and refresh transformation steps.
- Explore totals interactively: use a PivotTable, especially when readers need to rearrange fields without editing formulas.
For a one-off question, a formula may be quickest. For a report that must be refreshed each week, Power Query or a PivotTable can be easier to maintain. If other people will inspect or adjust the result, favor a method they can understand and refresh.
Filter rows with FILTER
Suppose a sales list has Region in column A, Item in B, Sales in C, and Date in D, with records in rows 2 through 6. To return West-region records with sales of at least 100, put this formula in an empty cell. It spills the matching rows into adjacent cells:
With regions in A2:A6, items in B2:B6, sales in C2:C6, and dates in D2:D6:
=FILTER(A2:D6,(A2:A6="West")*(C2:C6>=100),"No matches")
The two tests produce TRUE or FALSE values. Multiplying them acts like AND: a row must satisfy both conditions. For an OR condition, add the tests instead. In this example, the result contains the West Widget row with sales of 120 and the West Cable row with sales of 150. The third FILTER argument supplies a message if no record matches.
FILTER returns the rows and columns in the range you give it. If you only want the Item and Sales columns, CHOOSECOLS can select them from the filtered array:
With the same four-column data in A2:D6:
=CHOOSECOLS(FILTER(A2:D6,A2:A6="West"),2,3)
This returns the second and third columns of the filtered result. CHOOSECOLS is available in Microsoft 365 and Excel 2024. In older Excel versions, use a helper formula or Power Query to construct a result with selected columns.
Sort, group, and summarize results
To sort matching records by sales from highest to lowest, wrap FILTER in SORT. The sort index of 3 means the third column of the filtered array, and -1 requests descending order:
With the sales records in A2:D6, where Sales is the third column:
=SORT(FILTER(A2:D6,A2:A6="West","No matches"),3,-1)
This returns the three West rows in descending sales order: 150, 120, then 90. SORT orders the result; it does not change the order of the source records. If you only need a total for each group, use a summary formula or PivotTable rather than trying to force every operation into one formula.
For example, list the distinct item names in F2, then calculate each item’s sales total next to that list. The first formula returns Widget and Cable once each:
With item names in B2:B6:
=SORT(UNIQUE(B2:B6))
With item names in B2:B6, sales in C2:C6, and the spilled item list starting in F2:
=SUMIF(B2:B6,F2#,C2:C6)
The # after F2 refers to the full spilled range beginning there. The resulting totals are 290 for Widget (120 + 80 + 90) and 350 for Cable (150 + 200). UNIQUE, SORT, and dynamic spill references are available in Microsoft 365 and Excel 2021 or later. If you need several measures, such as sum and count by both region and item, a PivotTable or Power Query is usually clearer than building a large chain of formulas.
Use Power Query for repeatable transformations
Power Query is Excel’s data-import and transformation tool. It is a good fit when the source is a CSV, folder, database, or recurring export and you need to clean or reshape the data in consistent steps. Unlike a worksheet formula, a Power Query result is refreshed from its source rather than recalculated as a live formula array.
In Excel for Microsoft 365 on Windows, a common starting point for a range is to select a cell in the data and choose Data > From Table/Range. If the range is not already an Excel table, Excel may prompt you to confirm that the data has headers. In the Power Query Editor, you can filter rows, remove or reorder columns, change data types, group rows, and sort. Choose Home > Close & Load to return the result to Excel, or use the load options to choose a destination.
Power Query is not simply Excel’s version of the QUERY text language. It has its own interface and transformation language, and its steps are designed to be reapplied when you refresh. That makes it useful for repeatable workflows, but it may be unnecessary for a quick one-time filter. Available connectors and editing features can vary between Windows, Mac, and Excel for the web, so check the options in the version you use; the Windows desktop steps above are the most direct route described here.
When a PivotTable is the better match
A PivotTable is often the closest practical match to QUERY’s GROUP BY and aggregate operations. It summarizes rows by one or more fields without requiring a separate formula for each group. To create one in Excel for Microsoft 365 on Windows, select the data and choose Insert > PivotTable, then choose where to place it. Drag a category such as Region or Item into Rows, and drag a numeric field such as Sales into Values.
Excel normally summarizes numeric fields by Sum, but the calculation can be changed through the value field settings. You can add several fields to Rows, Columns, Filters, and Values, then rearrange them to explore another view. This is convenient for analysis, though a PivotTable’s layout is not as freely controlled as a formula-built report. When the source data changes, refresh the PivotTable; it does not always update merely because cells in the source were edited.
Use a PivotTable when a person needs to inspect totals by categories or adjust the grouping. Use formulas when you need a specific output layout that updates directly on the sheet. Use Power Query when the input needs repeatable cleanup before it is analyzed. These tools can also work together: Power Query can prepare the data, and a PivotTable can summarize it.
Common problems and limitations
- The formula returns #SPILL!: a cell in the required output area is occupied, or the formula is inside an Excel table that cannot host a spilled array in the usual way. Clear the obstructing cells or place the formula outside the table.
- Results do not update as expected: check whether the formula’s source range includes new rows. Converting source data to an Excel table can make formulas easier to maintain as records are added.
- Numbers or dates behave like text: imported values may be stored as text, so comparisons and totals can be misleading. Check the cell data types and convert the source values before relying on the result.
- A formula works for one condition but not several: FILTER needs conditions to align with the rows in its source array. Multiplication combines conditions as AND; addition combines them as OR. Parentheses help make the intended logic clear.
- A dynamic-array formula is not recognized: FILTER, SORT, and UNIQUE require Excel 2021 or Microsoft 365. Excel 2019 and earlier may need Advanced Filter, helper columns, a PivotTable, or Power Query instead.
- Sorting or filtering seems to change the source: a formula-generated result is a separate output, but an in-place sort or filter command acts on the selected source data. Keep an untouched copy if the original order matters.
One common misconception is that Excel’s FILTER is a complete replacement for QUERY. It handles row selection well, but it does not by itself provide every operation in a query, such as grouping, aggregation, labels, and all ordering options. Match each part of the task to a function or tool, and test the result against a small, known sample before using it in a recurring report.
Excel formulas versus QUERY: a practical comparison
QUERY can express several operations in one query string, which may feel compact once its syntax is familiar. Excel formulas tend to make each operation visible as a function: FILTER selects rows, SORT orders an array, and SUMIF or SUMIFS calculates totals. This can make a formula easier to inspect in pieces, but longer formulas may become difficult to maintain.
Excel’s other advantage is choice. A formula can produce a live, cell-based result; a PivotTable offers an interactive summary; and Power Query records a refreshable preparation workflow. The trade-off is that these are distinct tools, not interchangeable spellings of the same command. If you are translating a Google Sheets file, identify the intended output first—filtered detail, grouped totals, or a cleaned dataset—then rebuild that operation in the Excel tool suited to it.
Frequently Asked Questions
Does Excel have a QUERY function like Google Sheets?
No. Excel does not include a worksheet function named QUERY with Google Sheets’ query-language behavior. Use a combination of functions, a PivotTable, or Power Query according to the operation.
What is the simplest Excel equivalent of QUERY with a WHERE clause?
For returning rows that meet conditions, use FILTER. Combine conditions with multiplication for AND logic or addition for OR logic, and make sure each condition range covers the same rows as the data range.
How do I do GROUP BY in Excel?
Use a PivotTable for an interactive grouped summary, or combine UNIQUE with SUMIF, COUNTIF, or related functions for a formula-based result. Use SUMIFS when a total must match multiple criteria.
Can Excel FILTER replace Google Sheets QUERY?
Only for the filtering part of many queries. FILTER returns matching rows, but grouping, aggregation, column selection, and sorting may require other functions or a separate tool.
What should I use instead of QUERY in older Excel?
For filtering and summarizing, try Advanced Filter or a PivotTable. For repeatable data cleanup, use Power Query if it is available in your Excel version. The best option depends on whether you need a one-time result or a refreshable process.
Related
- Excel Text Across Cells Without Merging
- Excel Time Shortcut: How to Insert the Current Time
- Excel Time Format Over 24 Hours: Display Elapsed Time Correctly
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel Column Width and Row Height: Are They Equal?No. Excel column width and row height use different units, so entering the same number for each does…
- Excel Remove Duplicates and Keep the Newest DateTo remove duplicate records while keeping the newest date in Excel, sort the entire table by its date…
- Google Sheets IF Cell Contains: Formulas and ExamplesTo check whether a Google Sheets cell contains particular text, combine IF, ISNUMBER, and SEARCH. For example, if…
- Dependent Dropdowns in Google Sheets: How to Set Them UpTo create a dependent dropdown in Google Sheets, make a named range for each set of choices, then…
- How to Create a Work Signature in Outlook on Any DeviceTo create a work signature in Outlook, open the signature settings for your version of Outlook, add your…
- Excel Horizontal Page Breaks: Insert, Move, and RemoveAn Excel horizontal page break controls where one printed page ends and the next begins as you move…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.