Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

Google Sheets Sort Range


Sort Range

The Sort Range command in Google Sheets allows for more complex sorting of data.

For example it can work with data which has headers or have multiple sort rules.


Handling Data with Headers

Sort range makes it very easy to sort data with headers.

Example

Sort the Pokemon in the range A2:A21 by their Total stats, ascending from smallest to largest (A-Z).

Copy the values to follow along.

Copy Values

Sort range, step by step:

  1. Select all the data, range A2:B21

  1. Click on the Data menu and find Sort range

  1. Click on Sort range

  1. Select Data has header row

  1. Select Total stats which is the header for column B

  1. Click Sort

Well Done! You have successfully sorted the Pokemon by their total stats.



Multi-Level Sorting

Google Sheets lets you sort your data in multiple levels.

Example

Sort the Pokemon in the range A2:A21 by their Total stats, ascending from smallest to largest (A-Z) and then sort the results based on their Name.

Multi-level sort range, step by step:

  1. Select all the data, range A2:B21

  1. Click on the Data menu and find Sort range

  1. Click on Sort range

  1. Select Data has header row

  1. Select Total stats which is the header for column B

  1. Click on Add another sort column

  1. Select Name which is the header for column A

  1. Click Sort

Let's compare the results of this example with the previous example:


The image with the blue rectangle is the result of the first example and the image with the green rectangle is the result of the second example.

Look at rows 14:16.

The order of Pokemon has changed. In the second example they are also sorted alphabetically.

This is because we added an additional sort rule to Sort range.



×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.