Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Sort Function | Basic Functions
Google Spreadsheets
course content

Contenido del Curso

Google Spreadsheets

Google Spreadsheets

1. Introduction to Google Sheets
2. Formatting of Cells and Ranges
3. Advanced Formatting of Cells
4. Sorting, Filtering and Cleaning Data
5. Creating Charts
6. Basic Functions
7. Logical Functions
8. Collaboration and Security

book
Sort Function

In this chapter we will explore the Sort Function. The SORT function allows you to sort data ranges based on values in one or more columns. This is useful for organizing data and analyzing information in a more digestible format. One of the main advantages of the SORT function is that it uses dynamic arrays, meaning the data automatically updates when values in the table change. This ensures that you always see the most up-to-date information without having to manually resort the data.

Syntax and Examples

SORT(range, sort_column, is_ascending, [sort_column2, is_ascending2, ...])

  • range - The data to be sorted;
  • sort_column - The column index in the range or a range outside the specified range containing values for sorting;
    • The range specified as sort_column must be a single column with the same number of rows as the range;
  • is_ascending - TRUE or FALSE (1 or -1), indicating whether the sort_column should be sorted in ascending order FALSE sorts in descending order;
  • sort_column2, is_ascending2... - [OPTIONAL] Additional columns and sort order flags, specified in order of priority.
Input DataOutput Data
Student (Value A)Grade (Value B)FormulaStudentGrade
Isabella95SORT(A2:B6, 2, 1)Oliver73
Liam92Emily85
Noah88Noah88
Emily85Liam92
Oliver73Isabella95
SORT(A2:B6, 2, -1)Oliver73
Emily85
Noah88
Liam92
Isabella95
SORT(A2:B6, 1, 1)Emily85
Isabella95
Liam92
Noah88
Oliver73

SORT(A2:B6, 2, 1)

The formula sorts data by column B (Grade) in ascending order. Students are displayed starting from the lowest score.

SORT(A2:B6, 2, -1)

The formula sorts data by column B (Grade) in descending order. Students are displayed starting from the highest score.

SORT(A2:B6, 1, 1)

The formula sorts data by column A (Student) in alphabetical order. Students are displayed from A to Z.

Input DataOutput Data
ID (Value H)Name (Value I)Start Date (Value J)FormulaIDNameStart Date
1Emily2022-01-15SORT(H3:J11, MONTH(J3:J11), TRUE)1Emily2022-01-15
2Liam2021-05-107Elijah2024-01-22
3Noah2023-03-058Mia2023-02-14
4Oliver2020-08-203Noah2023-03-05
5Isabella2020-08-202Liam2021-05-10
6Ava2022-06-186Ava2022-06-18
7Elijah2024-01-224Oliver2020-08-20
8Mia2023-02-145Isabella2020-08-20
9Lucas2021-09-099Lucas2021-09-09
10Emma2023-10-01SORT(H3:J11, J3:J11, 1, I3:I11, 1)5Isabella2020-08-20
4Oliver2020-08-20
2Liam2021-05-10
9Lucas2021-09-09
1Emily2022-01-15
6Ava2022-06-18
8Mia2023-02-14
3Noah2023-03-05
7Elijah2024-01-22

SORT(H3:J11, MONTH(J3:J11), TRUE)

The formula sorts data by the month from column J (Start Date) in ascending order. People are displayed in order of their start dates throughout the year, starting from January.

SORT(H3:J11, J3:J11, 1, I3:I11, 1)

The formula sorts data first by column J (Start Date) in ascending order, and then by column I (Name) in alphabetical order for matching dates.

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 6. Capítulo 10
We're sorry to hear that something went wrong. What happened?
some-alt