How to sort your columns

Usually, the requirement is to be able to sort rows in a certain order. But once in a while, I have a need to sort the columns in a dataset. For example, I may want to order my columns in alphabetical order based on the column headers.

It's not too frequent a requirement, but it's sufficiently regularly to warrant addressing, given that Excel has no embedded functionality to do this.

If you have fewer than 16,384 rows of data, this can be done. First, create a new sheet. Copy the contents of your dataset. Go to cell A1 of your new sheet and Paste Special | Transpose. This will flip your data, putting the contents of row 1 in column A; row 2 in column B etc.

Now you can sort your dataset in the traditional way.

And finally, once you're ready, copy the sorted data and use Paste Special | Transpose to get it back into its original location.

Job done!

This entry was posted in How to. Bookmark the permalink.

2 Responses to How to sort your columns

Leave a Reply

Your email address will not be published. Required fields are marked *