In the simple example shown below, the data consist of the names and countries of a number of mountains together with their height above sea level. KSpread can sort data such as this in different ways.
We may want the data sorted so that the names are in alphabetical order. To do this select the area containing the data (A2:C7 in this case) and choose from the menu. This opens the Sorting dialog box. Using the Sort Criteria page of this dialog box you can choose which column of the data is to be used as a primary sort key and, if you wish, other columns to be used as secondary and tertiary keys. Using the example in the above screenshot, choosing column B as the first key and column C as the second would sort the data by country and, for each country, by height.
Sorting is done alphanumerically, and is case sensitive, numbers coming
before uppercase letters which come before lowercase letters, so that cells
containing the entries Cat
, bar
,
77
and Bat
would be sorted into
the following order: 77 Bat Cat bar.
The Options page of the dialog lets you sort by row instead of by column and allows you to sort using the order of items in a custom list such as January, February... instead of alphanumerically.
KSpread can also place the results of a sort into a different area of the sheet, or even into a different worksheet, rather than overwriting the original data. To do this enter the top left cell reference of the target area into the Destination Cell: text box and select a Destination Sheet: in the Options page. The cell formats will also be copied to the new area if you check the Copy cell Formatting (Borders, Colors, Text Style) box. If you check the First row contains headers box data in the first row will be copied directly to the first row of the target area without being included in the sort operation.
Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team