Table of Contents
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 firstnitems.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
nrows in the sorted range. - 1: Show at most the first
nrows, plus any additional rows that are identical to thenthrow. - 2: Show at most the first
nrows after removing duplicate rows. - 3: Show at most the first
nunique rows, but show every duplicate of these rows.
- 0: Show at most the first
sort_column1– [OPTIONAL] – The index of the column inrangeor a range outside ofrangecontaining the values to sort by. A range specified as asort_column1must be a single column with the same number of rows asrange.is_ascending1– [OPTIONAL] –TRUEorFALSEindicates how to sort sort_column1.TRUEsorts in ascending order.FALSEsorts in descending order.sort_column2, is_ascending2, ...– [OPTIONAL] – Additional columns and sort order flags used if a tie happens, in order of precedence.
Notes
rangeis sorted only by the specified columns. Other columns are returned in the order they originally appear.- If
sort_column1andis_ascending1aren’t included, the sort is performed on the lowest-index column inrange, 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.
| A | B | C | |
|---|---|---|---|
| 1 | Student | Test 1 score | Test 2 score |
| 2 | Alice | 100 | 90 |
| 3 | Bob | 75 | 85 |
| 4 | Carol | 80 | 85 |
| 5 | Devon | 100 | 95 |
| 6 | Eloise | 80 | 90 |
| Formula | Result |
|---|---|
| =SORTN(A2:C6) | Alice 100 90 |
| =SORTN(A2:C6, 2) | Alice 100 90 |
| =SORTN(A2:C6, 3, 0, B2:B6, FALSE) | Alice 100 90 |
| =SORTN(A2:C6, 3, 1, B2:B6, FALSE) | Alice 100 90 |
| =SORTN(A2:C6, 3, 2, B2:B6, FALSE) | Alice 100 90 |
| =SORTN(A2:C6, 3, 3, B2:B6, FALSE) | Alice 100 90 |
| =SORTN(A2:C6, 3, 3, 2, FALSE, 3, FALSE) | Devon 100 95 |
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.
