77 Sort Calc Database Data

 <  Day Day Up  >  

77 Sort Calc Database Data

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 .

Before You Begin

76 Import Data into a Calc Database

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.

See Also

78 Filter Data That You Want to See

79 Compute Table Totals and Subtotals

  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.



    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 .

  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.

    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 City , then by CompanyName , if two or more companies in your data range reside in the same city, the company names will be listed together and sorted alphabetically within that city's name, 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.



    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.

  3. 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 sort 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.

    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.

    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.



    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.

    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 City field, you would make sure that the City column appears in alphabetical order.

 <  Day Day Up  >  

Sams Teach Yourself OpenOffice.org All In One
Sams Teach Yourself OpenOffice.org All In One
ISBN: 0672326183
EAN: 2147483647
Year: 2003
Pages: 205
Authors: Greg Perry

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net