ExcelFormulas logoExcelFormulas.
Perguntar à IA
Matrizes DinâmicasTestado por QA

SORTBY.

Sorts a range based on values in a separate range or array.

Matrizes Dinâmicas
ExcelExcel 365Excel 2021Google Sheets

Como funciona na prática.

SORTBY é uma função essencial no Excel. Sorts a range based on values in a separate range or array. 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
=SORTBY(array, by_array1, [sort_order1], ...)
Dica: Argumentos entre colchetes [como_este] são opcionais; todos os outros são obrigatórios.

Argumentos.

Confira abaixo o detalhamento de cada parâmetro aceito por esta função.

arrayObrigatório

The range to sort and return.

Exemplo: A2:A5
by_array1Obrigatório

The criteria range to sort by.

Exemplo: B2:B5
sort_order1Opcional

1 for Ascending (default), -1 for Descending.

Padrão: 1

Exemplo passo a passo.

Cenário de Aplicação

Order Roster - Sort Names by Score

Extract only product names, sorted by their revenue column.

ProductRevenueSorted List
Product A120—
Product B500—
Product C310—
Fórmula Aplicada
=SORTBY(A2:A5, B2:B5, -1)
Resultado Esperado::Product B

Evaluates SORTBY over the sample table cells, placing the verified output in cell C2.

Gerador de fórmula.

Abrir Assistente Completo

Preencha os campos abaixo para gerar uma fórmula pronta para copiar e colar na sua planilha.

Generated FormulaPronta para copiar

Comportamento do resultado.

Returns "Product B" based on sample evaluation criteria and active cell references.

Amostra de Saída::Product B
Tipo de Dado::Text

Boas Práticas

  • Can sort by multiple priority levels: =SORTBY(names, department, 1, salary, -1).

Erros Mais Comuns

  • The by_array must have the exact same number of rows as the target array or #VALUE! occurs.
Matriz de Compatibilidade

Compatibilidade de software e versão.

Validação técnica fundamentada nas especificações oficiais da Microsoft e do Google.

Excel✓
Compatível
Excel 365✓
Compatível
Excel 2021✓
Compatível
Excel 2019✕
Não
Google Sheets✓
Compatível
Histórico e Versões do Excel

Introduced in Excel 365 and Excel 2021. Not available in Excel 2019.

Notas sobre o Google Planilhas

Supported in Google Sheets (uses SORTN or standard SORT with external array keys).

Perguntas frequentes.

Dúvidas Técnicas
Can I use SORTBY 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: =SORTBY(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 SORTBY?↓

The by_array must have the exact same number of rows as the target array or #VALUE! occurs.

Does SORTBY work identically in Google Sheets?↓

Yes, SORTBY is supported in both Microsoft Excel and Google Sheets with standard evaluation behavior.