Como funciona na prática.
QUERY é uma função essencial no Excel. Runs Google Visualization API SQL-like queries on data tables. Facilita a automação de relatórios, otimiza consultas de dados e garante máxima produtividade no seu fluxo de trabalho.
Sintaxe.
Notação Oficial do Excel=QUERY(data, query, [headers])Argumentos.
Confira abaixo o detalhamento de cada parâmetro aceito por esta função.
The cell range to query.
Exemplo:A1:C5SQL-like query string enclosed in quotation marks.
Exemplo:"SELECT A, C WHERE C > 150"Exemplo passo a passo.
Cenário de AplicaçãoHigh Value Orders Query
Extract products where sales exceed 150.
| Product | Region | Sales | Query Output | Output Sales |
|---|---|---|---|---|
| Widget A | East | 100 | — | — |
| Widget B | West | 300 | — | — |
| Widget C | East | 250 | — | — |
=QUERY(A1:C5, "SELECT A, C WHERE C > 150", 1)Evaluates QUERY over the sample table cells, placing the verified output in cell D2.
Gerador de fórmula.
Abrir Assistente CompletoPreencha os campos abaixo para gerar uma fórmula pronta para copiar e colar na sua planilha.
=QUERY()Comportamento do resultado.
Returns "Widget B" based on sample evaluation criteria and active cell references.
Boas Práticas
- Use uppercase keywords like SELECT and WHERE for readability.
Erros Mais Comuns
- Google Sheets QUERY requires data in each column to be consistently typed (avoid mixing numbers and text).
Compatibilidade de software e versão.
Validação técnica fundamentada nas especificações oficiais da Microsoft e do Google.
For Microsoft Excel, use the FILTER function (Excel 365 / 2021), SUMIFS/COUNTIFS, or Power Query (Get & Transform).
Not supported in Microsoft Excel. QUERY is a proprietary Google Sheets function that uses Google Visualization API SQL syntax.
Native Google Sheets formula. Runs pseudo-SQL queries over sheet ranges for filtering, aggregation, and grouping.
Perguntas frequentes.
Dúvidas TécnicasCan I use QUERY across different worksheets in Excel?↓
Yes. You can reference cells located on other sheets by including the sheet name followed by an exclamation mark, for example: =QUERY(Sheet2!A2:A10). If the sheet name contains spaces, enclose it in single quotes: ='Q1 Report'!A2:A10.
What is the most common reason for errors in QUERY?↓
Google Sheets QUERY requires data in each column to be consistently typed (avoid mixing numbers and text).