MS-Excel / Excel 2003

Sorting the Field Names in a Data List

You can use Excel's column-sorting capability to change the order of the fields in a data list without having to resort to cutting and pasting various columns of data. To sort the columns (fields) in a data list, you need to add a row at the top of the list that you then define as the primary sorting key. The cells in this row contain numbers (from 1 to the number of the last field in the data list) that indicate the new order of the fields.

When I opened the Sort dialog box (Data → Sort), Excel automatically selected Column A as the primary sort key in the Sort By drop-down list box. Then selected the No Header Row option button and clicked the Options button to open the Sort Options dialog box. Here, I selected the Sort Left to Right option button and then clicked OK. Excel changed Column A to Row 1 in the Sort By drop-down list box.

When sorting the columns in a data list, you must remember to click the Options button in the Sort dialog box and then select the Sort Left to Right option button in the Sort Options dialog box. Otherwise, Excel sorts your records instead of your columns, and in the process, the row of field names becomes sorted in with the other data records in your list!

[Previous] [Contents]