OpenOffice.org 2, Firefox, and Thunderbird for Windows All in One [Electronic resources]

Greg Perry, M. T. Cozzola, Jennifer Fulton

نسخه متنی -صفحه : 231/ 103
نمايش فراداده

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 .

KEY TERMS

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.

NOTE

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.

1.

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.

2.

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

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.

KEY TERM

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.

4.

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.