How can I sort data in Google Sheets?

How can I sort data in Google Sheets?

Sorting data in Google Sheets is a simple and efficient way to organize and analyze large amounts of information. To sort data in Google Sheets, first select the range of cells that you want to sort. Then, click on the “Data” tab and select “Sort Range” from the drop-down menu. A new window will appear, allowing you to choose the column to sort by, the sorting order (ascending or descending), and any additional criteria. Once you have made your selections, click “Sort” and your data will be automatically rearranged according to your chosen criteria. This feature is particularly useful for arranging data in a specific order or for quickly finding the highest or lowest values within a dataset. By utilizing the sorting function in Google Sheets, you can easily manipulate and organize your data to suit your needs.

SORTN

Returns the first n items in a data set after performing a sort.

Sample Usage

SORTN(A1:A10, 2)

SORTN(A2:C20, 2, 2, B2:B20, TRUE)

SORTN(A2:C20, 2, 3, B2:B20, TRUE, 3, FALSE)

Syntax

SORTN(range, [n], [display_ties_mode], [sort_column1, is_ascending1], ...)

  • range – The data to be sorted to find the first n items.
  • n – [OPTIONAL – 1 by default] The number of items to return. Must be greater than 0.
  • display_ties_mode – [OPTIONAL – 0 by default] A number representing the way to display ties.
    • 0: Show at most the first n rows in the sorted range.
    • 1: Show at most the first n rows, plus any additional rows that are identical to the nth row.
    • 2: Show at most the first n rows after removing duplicate rows.
    • 3: Show at most the first n unique rows, but show every duplicate of these rows.
  • sort_column1 – [OPTIONAL] – The index of the column in range or a range outside of range containing the values to sort by. A range specified as a sort_column1 must be a single column with the same number of rows as range.

  • is_ascending1 – [OPTIONAL] – TRUE or FALSE indicates how to sort sort_column1. TRUE sorts in ascending order. FALSE sorts in descending order.
  • sort_column2, is_ascending2, ... – [OPTIONAL] – Additional columns and sort order flags used if a tie happens, in order of precedence.

Notes

  • range is sorted only by the specified columns. Other columns are returned in the order they originally appear.
  • If sort_column1 and is_ascending1 aren’t included, the sort is performed on the lowest-index column in range, with subsequent columns used to sort if there are ties.

See Also

  • SORT: Sorts the rows of a given array or range by the values in one or more columns.
  • FILTER: Returns a filtered version of the source range, returning only rows or columns that meet the specified conditions.
  • MAX: Returns the maximum value in a numeric dataset.
  • INDEX: Returns the content of a cell, specified by row and column offset.
  • LARGE: Returns the nth largest element from a data set, where n is user-defined.

Examples

The following table is used for the examples below.

 ABC
1StudentTest 1 scoreTest 2 score
2Alice10090
3Bob7585
4Carol8085
5Devon10095
6Eloise8090

 

FormulaResult
=SORTN(A2:C6)

Alice 100 90

=SORTN(A2:C6, 2)

Alice 100 90
Bob 75 85

=SORTN(A2:C6, 3, 0, B2:B6, FALSE)

Alice 100 90
Devon 100 95
Carol 80 85

=SORTN(A2:C6, 3, 1, B2:B6, FALSE)

Alice 100 90
Devon 100 95
Carol 80 85
Eloise 80 90

=SORTN(A2:C6, 3, 2, B2:B6, FALSE)

Alice 100 90
Carol 80 85
Bob 75 85

=SORTN(A2:C6, 3, 3, B2:B6, FALSE)

Alice 100 90
Devon 100 95
Carol 80 85
Eloise 80 90
Bob 75 85

=SORTN(A2:C6, 3, 3, 2, FALSE, 3, FALSE)

Devon 100 95
Alice 100 90
Eloise 80 90

Cite this article

stats writer (2024). How can I sort data in Google Sheets?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-sort-data-in-google-sheets/

stats writer. "How can I sort data in Google Sheets?." PSYCHOLOGICAL SCALES, 29 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-sort-data-in-google-sheets/.

stats writer. "How can I sort data in Google Sheets?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-sort-data-in-google-sheets/.

stats writer (2024) 'How can I sort data in Google Sheets?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-sort-data-in-google-sheets/.

[1] stats writer, "How can I sort data in Google Sheets?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I sort data in Google Sheets?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top