Sorting data

From Apache OpenOffice Wiki
Jump to: navigation, search



The sorting mechanism in a Calc document rearranges the data in the sheet. The first step in sorting data is to select the data that you want to sort. To sort the data in Table 1, select the cells from A1 to G16—if you include the column headers, indicate this in the sort dialog. Use Data > Sort to open the Sort dialog. You can sort by up to three columns or rows at a time.

Sort by the Name column.

Click on the Options tab to set the sort options. Check the Range contains column labels checkbox to prevent column headers from being sorted with the rest of the data. The Sort by list box in the figure above displays the columns using the column headers if the Range contains column labels checkbox in the figure below is checked. If the Range contains column labels checkbox is not checked, however, then the columns are identified by their column name; Column A, for example.

Set sort options.

Normally, sorting the data causes the existing data to be replaced by the newly sorted data. The Copy sort results to checkbox, however, causes the selected data to be left unchanged and a copy of the sorted data is copied to the specified location. You can either directly enter a target address (Sheet3.A1, for example) or select a predefined range.

Check the Custom sort order checkbox to sort based on a predefined list of values. To set your own predefined lists, use Tools > Options > OpenOffice.org Calc > Sort Lists and then enter your own sort lists. Predefined sort lists are useful for sorting lists of data that should not be sorted alphabetically or numerically. For example, sorting days based on their name.

Documentation caution.png When a cell is moved during a sort operation, external references to that cell are not updated. If a cell that contains a relative reference to another cell is moved, the reference is relative to the new position when sorting is finished. Know the behavior of references during sorting and do not be alarmed, this is almost always what you want—because the reference is to the right or left in the same row. Also, I have not found a spreadsheet program that exhibits a different behavior for references while sorting.


Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools