Google Sheets – How Many Ways to Sort Data

google sheetssorting

When I'm working in a Google Spreadsheet, I always use the same routine to perform a sort.

Are there more ways to sort, that lead to Rome?

Best Answer

There are four ways for you to perform a sort. See list below in no particular order:

First (sheet)

Add the build-in filter function, by pressing the funnel and selecting the first row:
enter image description here
Then select the green down arrow in columnA, followed by descending (Z --> A):

enter image description here

Second (sheet)

Use this formula, on another sheet, to perform the sort you want:

=SORT('Build-in SORT'!A2:D,1,0)

Syntax of the sort is: SORT(range, column, sorting order)

Third (sheet)

With the usage of a script, complex sorting is possible as well. This one creates a menu item called Extra, containing an item called Sort:

function onOpen () {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var menu = [{name: "Sort", functionName: "mySort"}];
  ss.addMenu("Extra", menu);
}

function mySort() {
  SpreadsheetApp.getActiveSpreadsheet().getSheets()[2].getRange("A2:D")
    .sort({column: 1, ascending: false});
}

Goto Tools, Script Editor, from the menu and add the script. Make sure to press the two buttons:

enter image description here

Fourth (sheet)

Select column A and choose Data from the menu. Select "Sort sheet by Column A, Z --> A"

enter image description here

Make sure to fix the first row (otherwise the header will join the sort....) !!

Example File

I've prepared the following example file: Four Different Sorts