Section 78. Sort Calc Database Data

78. Sort Calc Database Data


77 Import Data into a Calc Database


79 Filter Data That You Want to See

80 Compute Table Totals and Subtotals

One of the reasons some people create a database data range from their spreadsheet data is to sort the data using Calc's database- related sorting tools. Once you set up the database, you can sort on amounts or text ascending or descending .


Ascending The sort method where lower values are sorted early in the list and higher values fall at the end of the list, as is the case with an alphabetical list of names .

Descending The sort method where higher values are sorted early in the list and lower values fall at the end of the list, as would be the case where payroll amounts are sorted from highest to lowest .

By sorting your data, you can often gain insights into it, such as where the top and bottom values lie, without having to resort to extra work to find those values (such as writing Max() or Min() functions in cells outside your database's data range). Also, you can print parts of the list in ZIP Code order as you might do when printing a list of names and addresses for a mailing.


When you sort a data range, you sort on one or more fields ( columns ), but all the data in all the rows of the data range sort along with your key sorting fields.

Request the Sort

Once you've defined the data range for the data you want to sort, select Data, Sort from the menu to display the Sort dialog box.

Specify Sort Criteria

Set up your sorting criteria by selecting a field name from the Sort by list box. The field names will be those fields you designated as field names (the labels atop the columns) when you created the data range.

78. Sort Calc Database Data

You can select optional second and even third sort criteria by selecting a field name from the next two Then by list boxes. For example, if you sort initially by UnitPrice , then by ProductName , if two or more products in your data range have the same unit price, they will be listed together and sorted alphabetically within that price, as long as you keep the Ascending options selected. If you change Ascending to Descending on any of the sort criteria field names, that criteria will sort from high to low instead of from low to high values.

Adjust Sorting Options

Click the Options tab to display the Options page in the Sort dialog box. The Options page enables you to adjust the way Calc sorts your data. You can make the sorts case sensitive so that lowercase letters are distinguished from (and considered to follow) uppercase letters . Therefore, eBay would follow Zsoft if you sort on company names. (Without the Case sensitive option checked, eBay would be listed before Zsoft because eBay precedes Zsoft in the alphabet.)


You'll almost always want to keep the Range contains column labels option checked so that Calc does not consider your field names at the top of the columns to be part of the data that it sorts. Also, keeping Include formats selected ensures your sorted data remains formatted properly.

To sort on one field at a time, you can also use the Sort Ascending and Sort Descending buttons on the Standard toolbar.

If you specify a range after Copy sort results to , Calc will sort the data but place it at that range, keeping your original data range intact. Otherwise, Calc sorts your original data. The Custom sort order option enables you, if you've created a custom sort list , to change the way Calc sorts your data from the normal alphabetical or numerical order to an order based on a different ranking system you define.


Custom sort list A predefined list of values (such as month names and the days of the week), or a list you define from the Tools, Options, Spreadsheet, Custom Lists option, that determines a special sorting rank that differs from the normal alphabetic or numerical sorts.

Because Calc databases are almost always stored with the rows representing records and the columns representing fields, keep the option labeled Top to bottom (sort rows) selected so that Calc sorts all rows properly. If you select the Left to right (sort columns) option, Calc sorts an entire column's data before looking at the next column, which can really mess up your data unless your original data imported was transposed for some reason.

When you click the OK button, Calc sorts your data in the order you requested .

Check the Sort

Once Calc finishes the sort, check the data to ensure that Calc sorted properly. For example, if you sorted by UnitPrice and then by ProductName fields in ascending order, you would make sure that the table is sorted from lowest priced products to highest, and that product names at the same price point appear in alphabetical order. 2, Firefox, and Thunderbird for Windows All in One
Sams Teach Yourself 2, Firefox and Thunderbird for Windows All in One
ISBN: 0672328089
EAN: 2147483647
Year: 2005
Pages: 232
Authors: Greg Perry © 2008-2017.
If you may any questions please contact us: