How Do I Sort by Date in OpenOffice Calc?

The Sort command in OpenOffice Calc.
Image Credit: Image courtesy of the Apache Software Foundation.

The Sort command in OpenOffice Calc 4.1, found in the Data menu, enables you to sort the data in your spreadsheet based on its contents, either in ascending or descending order. For the command to work correctly when sorting dates, the cells containing the dates must be formatted as dates. This is unlikely to be an issue in the majority of cases, since OpenOffice Calc is designed to identify an entry typed as a date in a cell and automatically apply the correct formatting.

If the cells were formatted as text before you typed the dates in, however, the command sorts them in alphabetical rather than chronological order. To solve this, select the cells, right-click, select Format Cells, change the category to Date and click OK. Depending on how the dates were originally entered, you may also need to further alter each cell. For example, OpenOffice Calc automatically adds an apostrophe as the first character to cells that are formatted as text but begin with a number, to force them to display properly; you will need to remove this apostrophe from each cell for the sorting to work correctly.

Step 1

Selecting the range of cells.
Image Credit: Image courtesy of the Apache Software Foundation.

Select the entire range of cells you want to sort.

Step 2

The Sort command in the Data menu.
Image Credit: Image courtesy of the Apache Software Foundation.

Click Data and select Sort.

Step 3

The Sort dialog window, with the relevant options highlighted.
Image Credit: Image courtesy of the Apache Software Foundation.

Select the column that contains the dates from the first drop-down menu and then select either the Ascending or Descending radio button, depending on whether you want to sort with the earliest date at the bottom or at the top.

Step 4

The Sort dialog window, with the OK button highlighted.
Image Credit: Image courtesy of the Apache Software Foundation.

Select a second and third column to sort by, if necessary, and then click OK.

Tip

To sort columns instead of rows, click the "Options" tab and select the "Left to Right" radio button before clicking "OK."

To see at a glance whether your cells are using the correct formatting, press "Ctrl-F8." Cells formatted as text display their contents in black, while cells formatted as numbers -- which includes dates -- display their contents in blue.