HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Ranges can be sorted using the Sort Ascending and Sort Descending commands
Ranges can be sorted using the Sort Ascending and Sort Descending commands.
The sort commands work for text too, using A-Z order.
Note: To sort a range that has more than one column, the whole range has to be selected. Sorting just one can breaks the relationship between columns.
This is shown in an example later in this chapter.
The commands are found in the Ribbon under the Sort & Filter menu ()
Sort the Pokemons in the range A2:A21 by their Name, ascending from smallest to largest (A-Z).
Note: A1 is not included as it is the header for the column. This is the row that is dedicated to the filter. Including it will blend it with the rest.
The Sort Ascending function successfully sorted the Pokemons by their Name ascending from A-Z.
Try again, this time with Sort Descending to see what that looks like!
Sort the Pokemons ascending by their Total stats from smallest to largest.
Select A2:A21
Open the Sort & Filter menu
Click Sort Ascending
In this example we have two columns with related data. Column A is the Pokemons Names and Column B is their Total stats. Try sorting just one of the columns (A2:A21) ascending by their Names.
The attempt to sort results in a warning.
It is not recommended to sort the names alone because it will break the relationship between the Pokemons Names and their Total stats.
This breaks the relationship with Column A and B. The Pokemons now have wrong Total stats.
Clicking the other option in the warning "Expand and Sort" makes the sort function include Column B and sorts them in relation to each other.
Select the whole range when sorting ranges with more than one column.
Note: When sorting multiple columns, it will always sort by the first column (leftmost).
Select A2:B21 and sort the range ascending.
By selecting range A2:B21 it sorts correctly, keeping the relationship between the data (Column A and B).
In the next chapter you will learn about Filter.
function copyFormulas(elementId){ /* Get the text field */ var copyText = document.getElementById(elementId); /* Select the text field */ copyText.select(); copyText.setSelectionRange(0, 99999); /* For mobile devices */ /* Copy the text inside the text field */ navigator.clipboard.writeText(copyText.value) .then(() => { alert('Range copied to clipboard.\nIt can now be pasted into the Excel spreadsheet.') }) .catch((error) => { alert(`Copy failed! ${error}`) }) }